-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support client side caching with RedisCluster #3102
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #3102 +/- ##
==========================================
+ Coverage 91.45% 91.58% +0.13%
==========================================
Files 128 128
Lines 33105 33162 +57
==========================================
+ Hits 30275 30372 +97
+ Misses 2830 2790 -40 ☔ View full report in Codecov by Sentry. |
await r.flushdb() | ||
await r.aclose() | ||
@pytest_asyncio.fixture | ||
async def r(request, create_redis): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great
|
||
r.flushdb() | ||
@pytest.fixture() | ||
def r(request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also glad to see
@@ -167,6 +167,13 @@ def parse_cluster_myshardid(resp, **options): | |||
"ssl_password", | |||
"unix_socket_path", | |||
"username", | |||
"cache_enable", | |||
"client_cache", | |||
"cache_max_size", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO I think we have enough duplication with all these. Part of another issue to clean up / tech debt?
) | ||
return response | ||
response_from_cache = connection._get_from_local_cache(args) | ||
if response_from_cache is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question that IMHO belongs elsewhere - looks like our others, and clean.
@@ -227,6 +227,10 @@ def __init__( | |||
_cache = None | |||
self.client_cache = client_cache if client_cache is not None else _cache | |||
if self.client_cache is not None: | |||
if self.protocol not in [3, "3"]: | |||
raise RedisError( | |||
"client caching is only supported with protocol version 3 or higher" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chayim As I remember we agreed to force RESP3 instead of raising an error? Error should be thrown after it
* sync * fix mock_node_resp * fix mock_node_resp_func * fix test_handling_cluster_failover_to_a_replica * fix test_handling_cluster_failover_to_a_replica * async cluster and cleanup tests * delete comment
* sync * fix mock_node_resp * fix mock_node_resp_func * fix test_handling_cluster_failover_to_a_replica * fix test_handling_cluster_failover_to_a_replica * async cluster and cleanup tests * delete comment
* sync * fix mock_node_resp * fix mock_node_resp_func * fix test_handling_cluster_failover_to_a_replica * fix test_handling_cluster_failover_to_a_replica * async cluster and cleanup tests * delete comment
This pull request extends the client-side-caching support to RedisCluster.