jedis icon indicating copy to clipboard operation
jedis copied to clipboard

issue #2220 - client side caching PoC test 1

Open tgrall opened this issue 3 years ago • 3 comments

Hi,

I have created a small Proof of Concept for Client Side Caching.

The ideas behind it:

  • almost transparent for the application, as soo as the jedis.clientTracking is called & enabled the cache is done for GET and HGETALL
  • it is really limited (currently all String and Hash are cached when used by a client connection (Prefix is not used)

Q1: Should I continue with this approach, where I make the cache almost transparent for the user, but it will impact all the client code to check if the connection is using CSC ?

OR should I used a different approach where the client instantiate a new class associated to the client, and have to call JedisClientCache.get/hgetall. (this allows a better isolation of the code for caching)

Q2: if I stay with the current approach I do not know how to create a new connection on the fly with the same connection string information (needed for Pub/Sub client in RESP2) this is why I pass a Jedis connection to the ClientTracking method down to the Client code itself.

As I said it is just a PoC open for comments/discussions. (few hours of work during my PTO while kids are sleeping.. so probably need a lot more thinking....)

tgrall avatar Aug 26 '20 07:08 tgrall

@tgrall

About Q1:

should I used a different approach where the client instantiate a new class associated to the client, and have to call JedisClientCache.get/hgetall. (this allows a better isolation of the code for caching)

This is not a strong opinion, but this sounds comparatively better to me.

BTW, how old are are your kids?

sazzad16 avatar Aug 26 '20 11:08 sazzad16

I will test another implementation tomorrow morning.

17/19/21 2 of them are coding a lot (java, node and more ... they have started with Minecraft programming)

tgrall avatar Aug 26 '20 14:08 tgrall

Your kids are not that kid then. Congrats!

sazzad16 avatar Aug 27 '20 04:08 sazzad16