public interface CachePlusOps extends CacheOps
使用本类接口时, 请切记,生产环境一定要配置成 REDIS !!!
| 限定符和类型 | 方法和说明 |
|---|---|
Boolean |
expire(CacheKey key)
为给定 key 设置生存时间,当 key 过期时(生存时间为 0 ),它会被自动删除。
|
Long |
hDel(CacheHashKey cacheHashKey)
删除哈希表 key 中的指定域,不存在的域将被忽略。
|
Long |
hDel(String key,
Object... fields)
删除哈希表 key 中的一个或多个指定域,不存在的域将被忽略。
|
Boolean |
hExists(CacheHashKey cacheHashKey)
检查给定域 field 是否存在于哈希表 hash 当中
|
<T> T |
hGet(CacheHashKey key,
boolean... cacheNullValues)
返回哈希表 key 中给定域 field 的值。
|
<T> T |
hGet(CacheHashKey key,
Function<CacheHashKey,T> loader,
boolean... cacheNullValues)
返回哈希表 key 中给定域 field 的值。
|
<K,V> Map<K,V> |
hGetAll(CacheHashKey key)
返回哈希表 key 中,所有的域和值。
|
<K,V> Map<K,V> |
hGetAll(CacheHashKey key,
Function<CacheHashKey,Map<K,V>> loader,
boolean... cacheNullValues)
返回哈希表 key 中,所有的域和值。
|
Double |
hIncrBy(CacheHashKey key,
double increment)
为哈希表 key 中的域 field 的值加上增量 increment 。
|
Long |
hIncrBy(CacheHashKey key,
long increment)
为哈希表 key 中的域 field 的值加上增量 increment 。
|
Set<Object> |
hKeys(CacheHashKey key)
返回哈希表 key 中的所有域。
|
Long |
hLen(CacheHashKey key)
返回哈希表 key 中域的数量。
|
void |
hSet(CacheHashKey key,
Object value,
boolean... cacheNullValues)
将哈希表 key 中的域 field 的值设为 value 。
|
List<Object> |
hVals(CacheHashKey key)
返回哈希表 key 中所有域的值。
|
Set<String> |
keys(String pattern)
查找所有符合给定模式 pattern 的 key 。
|
Boolean |
persist(CacheKey key)
移除给定 key 的生存时间,将这个 key 从『易失的』(带生存时间 key )转换成『持久的』(一个不带生存时间、永不过期的 key )。
|
Long |
pTtl(CacheKey key)
以毫秒为单位,返回给定 key 的剩余生存时间(TTL, time to live)。
|
Long |
sAdd(CacheKey key,
Object value)
将一个或多个 member 元素加入到集合 key 当中,已经存在于集合的 member 元素将被忽略。
|
List<String> |
scan(String pattern)
查找所有符合给定模式 pattern 的 key 。
|
void |
scanUnlink(String pattern)
查找所有符合给定模式 pattern 的 key ,并将其删除
例子:
KEYS * 匹配数据库中所有 key 。
|
Long |
sCard(CacheKey key)
返回集合 key 的基数(集合中元素的数量)。
|
Set<Object> |
sMembers(CacheKey key)
返回集合 key 中的所有成员。
|
<T> T |
sPop(CacheKey key)
移除并返回集合中的一个随机元素。
|
Long |
sRem(CacheKey key,
Object... members)
移除集合 key 中的一个或多个 member 元素,不存在的 member 元素会被忽略。
|
Long |
ttl(CacheKey key)
以秒为单位,返回给定 key 的剩余生存时间(TTL, time to live)。
|
String |
type(CacheKey key)
返回 key 所储存的值的类型。
|
Set<String> keys(@NonNull String pattern)
例子: KEYS * 匹配数据库中所有 key 。 KEYS h?llo 匹配 hello , hallo 和 hxllo 等。 KEYS a*cde 匹配 acde 和 aeeeeecde 等。 KEYS h[ae]llo 匹配 hello 和 hallo ,但不匹配 hillo 。
特殊符号用 \ 隔开
pattern - 表达式List<String> scan(@NonNull String pattern)
例子: KEYS * 匹配数据库中所有 key 。 KEYS h?llo 匹配 hello , hallo 和 hxllo 等。 KEYS a*cde 匹配 acde 和 aeeeeecde 等。 KEYS h[ae]llo 匹配 hello 和 hallo ,但不匹配 hillo 。
特殊符号用 \ 隔开
pattern - 表达式void scanUnlink(@NonNull
String pattern)
例子: KEYS * 匹配数据库中所有 key 。 KEYS h?llo 匹配 hello , hallo 和 hxllo 等。 KEYS a*cde 匹配 acde 和 aeeeeecde 等。 KEYS h[ae]llo 匹配 hello 和 hallo ,但不匹配 hillo 。
特殊符号用 \ 隔开
pattern - 表达式Boolean expire(@NonNull CacheKey key)
key - 一定不能为 null.Boolean persist(@NonNull CacheKey key)
key - 一定不能为 null.String type(@NonNull CacheKey key)
key - 一定不能为 null.Long ttl(@NonNull CacheKey key)
key - 一定不能为 null.Long pTtl(@NonNull CacheKey key)
key - 一定不能为 null.void hSet(@NonNull
CacheHashKey key,
Object value,
boolean... cacheNullValues)
key - 一定不能为 null.value - 值cacheNullValues - 是否缓存空对象<T> T hGet(@NonNull
CacheHashKey key,
boolean... cacheNullValues)
key - 一定不能为 null.cacheNullValues - 是否缓存空值<T> T hGet(@NonNull
CacheHashKey key,
Function<CacheHashKey,T> loader,
boolean... cacheNullValues)
key - 一定不能为 null.loader - 加载器cacheNullValues - 是否缓存空值Boolean hExists(@NonNull CacheHashKey cacheHashKey)
cacheHashKey - 一定不能为 null.Long hDel(@NonNull String key, Object... fields)
key - 一定不能为 null.fields - 一定不能为 null.Long hDel(@NonNull CacheHashKey cacheHashKey)
cacheHashKey - 一定不能为 null.Long hLen(@NonNull CacheHashKey key)
key - 一定不能为 null.Long hIncrBy(@NonNull CacheHashKey key, long increment)
key - 一定不能为 null.increment - 增量Double hIncrBy(@NonNull CacheHashKey key, double increment)
key - 一定不能为 null.increment - 增量Set<Object> hKeys(@NonNull CacheHashKey key)
key - 一定不能为 null.List<Object> hVals(@NonNull CacheHashKey key)
key - 一定不能为 null.<K,V> Map<K,V> hGetAll(@NonNull CacheHashKey key)
key - 一定不能为 null.<K,V> Map<K,V> hGetAll(@NonNull CacheHashKey key, Function<CacheHashKey,Map<K,V>> loader, boolean... cacheNullValues)
key - 一定不能为 null.loader - 加载回调cacheNullValues - 缓存空值Long sAdd(@NonNull CacheKey key, Object value)
key - 一定不能为 null.value - 值Long sRem(@NonNull CacheKey key, Object... members)
key - 一定不能为 null.members - 元素Set<Object> sMembers(@NonNull CacheKey key)
key - 一定不能为 null.<T> T sPop(@NonNull
CacheKey key)
key - 一定不能为 null.Copyright © 2022. All rights reserved.