spring-data-redis
spring-data-redis copied to clipboard
Refactor duplicated TTL computation in DefaultRedisCacheWriter's get method
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);