python import redis try: r = redis.Redis(host='localhost', port=6379) except redis.ConnectionError as e: python import redis try: r = redis.Redis(host='localhost', port=6379) r.set('key', 'value') except redis.exceptions.ResponseError as e: python import redis try: pool = redis.ConnectionPool(host='localhost', port=6379, max_connections=2) r = redis.Redis(connection_pool=pool) except redis.ConnectionPool as e: python import redis r = redis.Redis(host='localhost', port=6379) print(r.get('key')) python import pdb import redis def some_function(): r = redis.Redis(host='localhost', port=6379) some_function() Traceback (most recent call last): File "example.py", line 5, in <module> r.get('key') File "/path/to/redis/redis/client.py", line 3624, in get return self.execute_command('GET', name) ... redis.exceptions.ResponseError: command GET key not allowed


上一篇:
下一篇:
切换中文