Skip to content
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

Merged
merged 7 commits into from
Jan 9, 2024

Conversation

dvora-h
Copy link
Collaborator

@dvora-h dvora-h commented Jan 8, 2024

This pull request extends the client-side-caching support to RedisCluster.

@dvora-h dvora-h requested a review from chayim January 8, 2024 14:04
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (b5d4d29) 91.45% compared to head (2bf4c14) 91.58%.

Files Patch % Lines
redis/asyncio/cluster.py 90.90% 1 Missing ⚠️
redis/asyncio/connection.py 50.00% 1 Missing ⚠️
redis/cluster.py 90.00% 1 Missing ⚠️

❗ 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.
📢 Have feedback on the report? Share it here.

@dvora-h dvora-h marked this pull request as ready for review January 9, 2024 01:26
@dvora-h dvora-h requested a review from a team January 9, 2024 01:27
@chayim chayim added the feature New feature label Jan 9, 2024
await r.flushdb()
await r.aclose()
@pytest_asyncio.fixture
async def r(request, create_redis):
Copy link
Contributor

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):
Copy link
Contributor

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",
Copy link
Contributor

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@chayim chayim left a 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.

redis/asyncio/cluster.py Show resolved Hide resolved
@@ -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"
Copy link
Collaborator

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

redis/cluster.py Show resolved Hide resolved
redis/asyncio/cluster.py Show resolved Hide resolved
@dvora-h dvora-h merged commit c7a13ae into redis:master Jan 9, 2024
46 checks passed
vladvildanov pushed a commit that referenced this pull request Sep 27, 2024
* 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
vladvildanov pushed a commit that referenced this pull request Sep 27, 2024
* 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
vladvildanov pushed a commit that referenced this pull request Sep 27, 2024
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants