redisson设置key过期时间失败
redisson
Redisson - Easy Redis Java client with features of In-Memory Data Grid. Sync/Async/RxJava/Reactive API. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, RPC, local cache ...
项目地址:https://gitcode.com/gh_mirrors/re/redisson
免费下载资源
·
使用代码如下:
public static void saveHash(String key,String field,String val,int seconds){
RMap<Object, Object> rmap = redissonClient.getMap(key);
//设置过期时间
rmap.expire(seconds, TimeUnit.SECONDS);
rmap.put(field,val);
}
其中的expire方法,发现设置失败了,返回false
发现是在代码
RMap<Object, Object> rmap = redissonClient.getMap(key)
中,当redis中不存在该key时,那么对其设置过期时间就会失败。
GitHub 加速计划 / re / redisson
2
3
下载
Redisson - Easy Redis Java client with features of In-Memory Data Grid. Sync/Async/RxJava/Reactive API. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, RPC, local cache ...
最近提交(Master分支:3 个月前 )
15bd94ed - 4 个月前
d220f2a8 - 4 个月前
更多推荐
已为社区贡献6条内容
所有评论(0)