jedis icon indicating copy to clipboard operation
jedis copied to clipboard

Feature/csc ttl support

Open PengJingzhao opened this issue 9 months ago • 5 comments

Hello, I add a ttl support for the jedis csc (extend the DefaultCache) to solve a issue of the jedis.You can read my commit record for the details

PengJingzhao avatar Mar 23 '25 10:03 PengJingzhao

If somebody help me review it? Thankyou very much!

PengJingzhao avatar Mar 23 '25 10:03 PengJingzhao

Related to https://github.com/redis/jedis/issues/4117

ggivo avatar Mar 24 '25 07:03 ggivo

There is an ongoing discussion regarding adding TTL to CSC in Jedis tracked with https://github.com/redis/jedis/issues/4117 Can we take a step back and try to identify what is the issue we are trying to solve before getting to the implementation?

ggivo avatar Mar 28 '25 08:03 ggivo

Of course! I can explain in detail what my PR does. In my PR, I extend the DefaultCache class under the csc package. In the extended class, I use a Map called expirationTimes to maintain an expiration time for each cache key. Additionally, I start a thread to periodically clean up keys that have already expired.

PengJingzhao avatar Mar 28 '25 08:03 PengJingzhao

My question was about the problem we want to solve before going into concrete implementations. CSC is not intended to be a generic cache and is driven by notification from Redis server. Instead of providing an TTL implementation inside Jedis, another approach is to use integrate a third-party cache library instead of the DefaultCache implementstion provided.

ggivo avatar Mar 28 '25 08:03 ggivo