Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.23.1
-
None
-
Unknown
Description
When getting new input and seeing for example the same file name for the second time before expiry hits, add will simply reset the expiry to the original value independent of the set being successful or not.
This way, the key will never expire if add is called more freuqently than the key expires.
public boolean add(String key) { boolean added = valueOperations.setIfAbsent(createRedisKey(key), key); if (expiry > 0) { valueOperations.getOperations().expire(createRedisKey(key), expiry, TimeUnit.SECONDS); } return added; }
this should probably rather be:
public boolean add(String key) { return valueOperations.setIfAbsent(createRedisKey(key), key, Duration.ofSeconds(expiry)); }