Interface Cache
- All Known Implementing Classes:
LocalCacheImpl,RedisCacheImpl
public interface Cache
缓存服务
- Author:
- Toint
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) 缓存是否存在void删除缓存获取缓存multiGet(Collection<String> keys) 获取缓存void设置缓存booleanputIfAbsent(String key, String value, Duration timeout) 设置缓存如果不存在
-
Method Details
-
put
设置缓存- Parameters:
key- 缓存键, 不能为空value- 缓存值timeout- 缓存时间, 不能为空
-
putIfAbsent
设置缓存如果不存在- Parameters:
key- 缓存键, 不能为空value- 缓存值timeout- 缓存时间, 不能为空- Returns:
- true=设置成功, false=不成功
-
get
获取缓存- Parameters:
key- 缓存键- Returns:
- 缓存值
-
multiGet
获取缓存- Parameters:
keys- 缓存键- Returns:
- 缓存值集合, 如果对应位置的key不存在, 则用null占位
-
containsKey
缓存是否存在- Parameters:
key- 缓存键, 不能为空- Returns:
- true=存在, false=不存在
-
delete
删除缓存- Parameters:
key- 缓存键, 不能为空
-