-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueOperation setIFAbsent with ttl not working. #2081
Comments
I checked |
I got the problem, How can I update a key value without clearing its ttl ? |
I see - there's an return execute(connection -> connection.set(rawKey, rawValue, Expiration.keepTtl(), SetOption.ifPresent()), true); I created #2084 for that. |
Got this this error org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR syntax error code is public void update(String key, Object value) {
@SuppressWarnings("unchecked")
|
|
nothing..just this error. |
its working finally with redis 6. Thanks. |
I am using RedisTemplate with LettuceConnection Factory(in spring boot) to set key in Redis with ttl ,
Key is getting Set in redis but its ttl not getting set.
when I try to set ttl using redis-cli , its getting set.
here is the code.
public Boolean setIfAbsent(String key, Object value, long timeout, TimeUnit unit) { Boolean isSuccess = Boolean.FALSE; String absoluteKey = generateAbsoluteKey(key); log.info("Setting key {} in redis..", absoluteKey); try { String sValue = objectMapper.writeValueAsString(value); redisTemplate.opsForValue() .setIfAbsent(absoluteKey, sValue, timeout, unit); } catch (Exception e) { log.error("Error in saving value to redis cache for key: " + absoluteKey, e); } return isSuccess; }
RedisConfiguration is like following
implementation group: 'org.springframework.data', name: 'spring-data-redis'
`@Bean
public LettuceConnectionFactory lettuceConnectionFactory() {
return new LettuceConnectionFactory(hostName, port);
}
There is no error on console.
I am using spring-data-redis-2.5.0-M5
redis version I have tried with 6.2 also 4.0 .
Please suggest.
The text was updated successfully, but these errors were encountered: