[
https://issues.apache.org/jira/browse/CAMEL-13397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrea Cosentino reassigned CAMEL-13397:
----------------------------------------
Assignee: Andrea Cosentino
> RedisStringIdempotentRepository resetting expiry on existing keys
> -----------------------------------------------------------------
>
> Key: CAMEL-13397
> URL: https://issues.apache.org/jira/browse/CAMEL-13397
> Project: Camel
> Issue Type: Bug
> Components: camel-spring-redis
> Affects Versions: 2.23.1
> Reporter: Chris Schwarzfischer
> Assignee: Andrea Cosentino
> Priority: Major
>
> 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.
>
> {code:java}
> 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;
> }{code}
> this should probably rather be:
> {code:java}
> public boolean add(String key) {
> return valueOperations.setIfAbsent(createRedisKey(key), key,
> Duration.ofSeconds(expiry));
> }{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)