diff --git a/README.md b/README.md index 52611038..ddc30c6e 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,18 @@ b'bar' The above code connects to localhost on port 6379, sets a value in Redis, and retrieves it. All responses are returned as bytes in Python, to receive decoded strings, set *decode_responses=True*. For this, and more connection options, see [these examples](https://valkey-py.readthedocs.io/en/stable/examples.html). +### Migration from redis-py + +You are encouraged to use the new class names, but to allow for a smooth transition alias are available: + +``` python +>>> import valkey as redis +>>> r = redis.Redis(host='localhost', port=6379, db=0) +>>> r.set('foo', 'bar') +True +>>> r.get('foo') +b'bar' +``` #### RESP3 Support To enable support for RESP3 change your connection object to include *protocol=3* diff --git a/valkey/__init__.py b/valkey/__init__.py index f12f800e..9190f7fa 100644 --- a/valkey/__init__.py +++ b/valkey/__init__.py @@ -60,6 +60,13 @@ def int_or_str(value): except AttributeError: VERSION = tuple([99, 99, 99]) + +Redis = Valkey +StrictRedis = StrictValkey +RedisCluster = ValkeyCluster +RedisError = ValkeyError + + __all__ = [ "AuthenticationError", "AuthenticationWrongNumberOfArgsError", @@ -71,24 +78,28 @@ def int_or_str(value): "ConnectionPool", "CredentialProvider", "DataError", - "from_url", - "default_backoff", "InvalidResponse", "OutOfMemoryError", "PubSubError", "ReadOnlyError", - "Valkey", - "ValkeyCluster", - "ValkeyError", + "Redis", + "RedisCluster", + "RedisError", "ResponseError", + "SSLConnection", "Sentinel", "SentinelConnectionPool", "SentinelManagedConnection", "SentinelManagedSSLConnection", - "SSLConnection", - "UsernamePasswordCredentialProvider", + "StrictRedis", "StrictValkey", "TimeoutError", "UnixDomainSocketConnection", + "UsernamePasswordCredentialProvider", + "Valkey", + "ValkeyCluster", + "ValkeyError", "WatchError", + "default_backoff", + "from_url", ]