spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

Refactor duplicated TTL computation in DefaultRedisCacheWriter's get method

Open diydriller opened this issue 1 month ago • 0 comments

Problem

In DefaultRedisCacheWriter's get method, following expression is evaluated twice

  timeToIdleEnabled && withTtl ? ttl : null

Proposed Improvement

Extract the conditional TTL evaluation into a single variable

  Duration ttlForGet = (timeToIdleEnabled && withTtl ? ttl : null);

diydriller avatar Nov 20 '25 17:11 diydriller