You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DefaultHashOperations.getTimeToLive converts hash-field TTL values twice for non-second TimeUnits #3427
DefaultHashOperations.getTimeToLive(H key, TimeUnit timeUnit, Collection<HK> hashKeys) calls the unit-aware hTtl(rawKey, timeUnit, rawHashKeys), whose driver implementations (LettuceHashCommands, JedisHashCommands via Converters.secondsToTimeUnit) already convert the server's seconds into timeUnit — but then labels the returned values as seconds:
so Expirations converts them a second time. Requesting TimeUnit.MINUTES for a field with a 120-second TTL yields an Expiration of 2 seconds (and expiration.value() = 0 minutes) instead of 2 minutes — a 60x error (3600x for hours).
The reactive counterpart (DefaultReactiveHashOperations.getTimeToLive) correctly fetches plain seconds with the unit-less hTtl and lets Expirations do the single conversion.
Expected: the imperative implementation matches the reactive one, fetching seconds and converting once. Reproduced on main with a mock-based unit test. I will submit a PR with a fix and test.
Activity
Polish
Fetch hash field TTLs in seconds in DefaultHashOperations.
Polish
Fetch hash field TTLs in seconds in DefaultHashOperations.
Polish
Fetch hash field TTLs in seconds in DefaultHashOperations.