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

fix: duplicated conditional TTL evaluation

Open diydriller opened this issue 1 month ago • 1 comments

Summary

This PR refactors duplicated TTL computation logic inside DefaultRedisCacheWriter's get method

following expression was previously evaluated twice

  timeToIdleEnabled && withTtl ? ttl : null

What Changed

A new local variable ttlForGet is introduced to compute the TTL once

Closes: https://github.com/spring-projects/spring-data-redis/issues/3266

diydriller avatar Nov 20 '25 17:11 diydriller