public interface CacheOps
| 限定符和类型 | 方法和说明 |
|---|---|
Long |
decr(CacheKey key)
为键 key 储存的数字值减去一。
|
Long |
decrBy(CacheKey key,
long decrement)
将 key 所储存的值减去减量 decrement 。
|
Long |
del(CacheKey... keys)
删除指定的key
|
Long |
del(String... keys)
删除指定的key
|
Boolean |
exists(CacheKey key)
判断指定的key 是否存在
|
<T> List<T> |
find(Collection<CacheKey> keys)
根据keys获取对象
|
void |
flushDb()
清空所有存储的数据
|
<T> T |
get(CacheKey key,
boolean... cacheNullValues)
根据key获取对象
|
<T> T |
get(CacheKey key,
Function<CacheKey,? extends T> loader,
boolean... cacheNullValues)
根据key获取对象
不存在时,调用function回调获取数据,并set进入,然后返回
|
<T> T |
get(String key,
boolean... cacheNullValues)
根据key获取对象
|
Long |
getCounter(CacheKey key,
Function<CacheKey,Long> loader)
获取key中存放的Long值
|
Long |
incr(CacheKey key)
为键 key 储存的数字值加上一。
|
Long |
incrBy(CacheKey key,
long increment)
为键 key 储存的数字值加上increment。
|
Double |
incrByFloat(CacheKey key,
double increment)
为键 key 储存的数字值加上一。
|
void |
set(CacheKey key,
Object value,
boolean... cacheNullValues)
添加到带有 过期时间的 缓存
|
void set(@NonNull
CacheKey key,
Object value,
boolean... cacheNullValues)
key - redis主键value - 值cacheNullValues - 是否缓存null对象<T> T get(@NonNull
CacheKey key,
boolean... cacheNullValues)
key - redis主键cacheNullValues - 是否缓存null对象<T> T get(@NonNull
String key,
boolean... cacheNullValues)
key - redis主键cacheNullValues - 是否缓存null对象<T> List<T> find(@NonNull Collection<CacheKey> keys)
keys - redis主键<T> T get(@NonNull
CacheKey key,
Function<CacheKey,? extends T> loader,
boolean... cacheNullValues)
key - redis主键loader - 加载器cacheNullValues - 是否缓存null对象void flushDb()
Long incr(@NonNull CacheKey key)
key - 一定不能为 null.Long getCounter(@NonNull CacheKey key, Function<CacheKey,Long> loader)
key - 一定不能为 null.loader - 加载Long incrBy(@NonNull CacheKey key, long increment)
key - 一定不能为 null.increment - 增量值Double incrByFloat(@NonNull CacheKey key, double increment)
key - 一定不能为 null.increment - 增量值Long decr(@NonNull CacheKey key)
key - 一定不能为 null.Copyright © 2023. All rights reserved.