summaryrefslogtreecommitdiff
path: root/redis/sentinel.py
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2018-11-13 16:44:36 -0800
committerAndy McCurdy <andy@andymccurdy.com>2018-11-13 16:44:36 -0800
commit36a84fc9ac4e06a9b85ccc4e4eda426b387c7093 (patch)
treeda94cf7658346e86eb212d507de9cbd4511b97d8 /redis/sentinel.py
parent90a52dd5de111f0053bb3ebaa7c78f73a82a1e3e (diff)
downloadredis-py-36a84fc9ac4e06a9b85ccc4e4eda426b387c7093.tar.gz
remove legacy Redis class
redis-py maintained backwards compatibility by keeping the old "Redis" class around for quite some time. While no doubt a convenience for folks who relied on it, the presence of both Redis and StrictRedis causes a number of support issues and general confusion. With 3.0, we're breaking a few things to make redis-py better going forward. This change removes the old Redis class. We also renamed the StrictRedis class to Redis and aliased StrictRedis to Redis. For people that have been using StrictRedis, this should not change anything. You can continue doing things as you are. People still using the legacy Redis class will need to update the argument order for the SETEX, LREM and ZADD commands. Additionally, the return values for TTL and PTTL now return the integer values -1 when a key exists but has no expire time and -2 when a key does not exist. Previously these cases returned a None value in the Redis class.
Diffstat (limited to 'redis/sentinel.py')
-rw-r--r--redis/sentinel.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/redis/sentinel.py b/redis/sentinel.py
index 0a9f2d3..9df2997 100644
--- a/redis/sentinel.py
+++ b/redis/sentinel.py
@@ -2,7 +2,7 @@ import os
import random
import weakref
-from redis.client import StrictRedis
+from redis.client import Redis
from redis.connection import ConnectionPool, Connection
from redis.exceptions import (ConnectionError, ResponseError, ReadOnlyError,
TimeoutError)
@@ -178,7 +178,7 @@ class Sentinel(object):
}
self.sentinel_kwargs = sentinel_kwargs
- self.sentinels = [StrictRedis(hostname, port, **self.sentinel_kwargs)
+ self.sentinels = [Redis(hostname, port, **self.sentinel_kwargs)
for hostname, port in sentinels]
self.min_other_sentinels = min_other_sentinels
self.connection_kwargs = connection_kwargs
@@ -244,7 +244,7 @@ class Sentinel(object):
return slaves
return []
- def master_for(self, service_name, redis_class=StrictRedis,
+ def master_for(self, service_name, redis_class=Redis,
connection_pool_class=SentinelConnectionPool, **kwargs):
"""
Returns a redis client instance for the ``service_name`` master.
@@ -255,7 +255,7 @@ class Sentinel(object):
NOTE: If the master's address has changed, any cached connections to
the old master are closed.
- By default clients will be a redis.StrictRedis instance. Specify a
+ By default clients will be a redis.Redis instance. Specify a
different class to the ``redis_class`` argument if you desire
something different.
@@ -272,7 +272,7 @@ class Sentinel(object):
return redis_class(connection_pool=connection_pool_class(
service_name, self, **connection_kwargs))
- def slave_for(self, service_name, redis_class=StrictRedis,
+ def slave_for(self, service_name, redis_class=Redis,
connection_pool_class=SentinelConnectionPool, **kwargs):
"""
Returns redis client instance for the ``service_name`` slave(s).
@@ -280,7 +280,7 @@ class Sentinel(object):
A SentinelConnectionPool class is used to retrive the slave's
address before establishing a new connection.
- By default clients will be a redis.StrictRedis instance. Specify a
+ By default clients will be a redis.Redis instance. Specify a
different class to the ``redis_class`` argument if you desire
something different.