Skip to content

Commit 2572167

Browse files
committed
Changed defaults to correct values
1 parent ba94215 commit 2572167

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

redis/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ def __init__(
216216
use_cache: bool = False,
217217
cache: Optional[CacheInterface] = None,
218218
cache_eviction: Optional[EvictionPolicy] = None,
219-
cache_size: int = 128,
220-
cache_ttl: int = 300,
219+
cache_size: int = 10000,
220+
cache_ttl: int = 0,
221221
) -> None:
222222
"""
223223
Initialize a new Redis client.

redis/cluster.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,8 @@ def __init__(
508508
use_cache: bool = False,
509509
cache: Optional[CacheInterface] = None,
510510
cache_eviction: Optional[EvictionPolicy] = None,
511-
cache_size: int = 128,
512-
cache_ttl: int = 300,
511+
cache_size: int = 10000,
512+
cache_ttl: int = 0,
513513
**kwargs,
514514
):
515515
"""
@@ -1336,8 +1336,8 @@ def __init__(
13361336
use_cache: bool = False,
13371337
cache: Optional[CacheInterface] = None,
13381338
cache_eviction: Optional[EvictionPolicy] = None,
1339-
cache_size: int = 128,
1340-
cache_ttl: int = 300,
1339+
cache_size: int = 10000,
1340+
cache_ttl: int = 0,
13411341
**kwargs,
13421342
):
13431343
self.nodes_cache = {}

redis/connection.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -734,10 +734,7 @@ class CacheProxyConnection(ConnectionInterface):
734734
KEYS_MAPPING_CACHE_SIZE = 10000
735735

736736
def __init__(
737-
self,
738-
conn: ConnectionInterface,
739-
cache: CacheInterface,
740-
conf: CacheConfiguration
737+
self, conn: ConnectionInterface, cache: CacheInterface, conf: CacheConfiguration
741738
):
742739
self.pid = os.getpid()
743740
self._conn = conn
@@ -830,7 +827,8 @@ def read_response(
830827
# Check if command response exists in a cache and it's not in progress.
831828
if (
832829
self._cache.exists(self._current_command_hash)
833-
and self._cache.get(self._current_command_hash) != self.CACHE_DUMMY_STATUS
830+
and self._cache.get(self._current_command_hash)
831+
!= self.CACHE_DUMMY_STATUS
834832
):
835833
return copy.deepcopy(self._cache.get(self._current_command_hash))
836834

@@ -1444,7 +1442,7 @@ def make_connection(self) -> "ConnectionInterface":
14441442
return CacheProxyConnection(
14451443
self.connection_class(**self.connection_kwargs),
14461444
self.cache,
1447-
self._cache_conf
1445+
self._cache_conf,
14481446
)
14491447

14501448
return self.connection_class(**self.connection_kwargs)

tests/test_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def r(request):
3838

3939
@pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
4040
@pytest.mark.onlynoncluster
41-
@skip_if_resp_version(2)
41+
# @skip_if_resp_version(2)
4242
class TestCache:
4343
@pytest.mark.parametrize(
4444
"r",

0 commit comments

Comments
 (0)