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 for client-side caching - phase 2 #3673

Merged
merged 6 commits into from
Jan 8, 2024
Merged

Conversation

sazzad16
Copy link
Collaborator

@sazzad16 sazzad16 commented Jan 1, 2024

No description provided.

@sazzad16 sazzad16 requested review from chayim and uglide and removed request for uglide January 2, 2024 10:42
@sazzad16 sazzad16 marked this pull request as ready for review January 2, 2024 10:43
@chayim chayim changed the title Support for clilent-side caching - phase 2 Support for client-side caching - phase 2 Jan 2, 2024
@@ -24,7 +24,7 @@ public JedisClientSideCache(final HostAndPort hostPort, final JedisClientConfig

private void clientTrackingOn() {
String reply = connection.executeCommand(new CommandObject<>(
new CommandArguments(Protocol.Command.CLIENT).add("TRACKING").add("ON").add("BCAST"),
new CommandArguments(Protocol.Command.CLIENT).add("TRACKING").add("ON"),
Copy link
Contributor

@chayim chayim Jan 8, 2024

Choose a reason for hiding this comment

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

Correct, though make sure you're cognizant of (hopefully) future support for broadcast and friends.

ensureFillSafe();
return buf[count];
public boolean peek(byte b) throws JedisConnectionException {
ensureFill(); // in current design, at least one reply is expected. so ensureFillSafe() is not necessary.
Copy link
Contributor

Choose a reason for hiding this comment

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

But, what happens if there is no reply? It shouldn't occur, but maybe there's something we can do for resiliency here. At the very least raise a data specific exception so that we can know this happened?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@chayim A JedisConnectionException wrapping a ReadTimeoutException will be thrown.

jedis.set("foo", "bar");
assertEquals("bar", jCache.get("foo"));
jedis.del("foo");
assertNull(jCache.get("foo"));
assertThat(jCache.get("foo"), Matchers.oneOf("bar", null)); // ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be achieved without adding this import?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@chayim We'd have to write a "utility" method.
But why bother? We already have these as our test dependency and being used in some other tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

General desire to have fewer dependencies.. even if it's just for test. Not a hard requirement.

@sazzad16 sazzad16 requested a review from chayim January 8, 2024 14:18
@sazzad16 sazzad16 merged commit 89617c9 into redis:5.2.0 Jan 8, 2024
1 check passed
@sazzad16 sazzad16 deleted the csc-sync-02 branch January 8, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants