public interface RedisSession extends AutoCloseable
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
关闭会话
|
long |
decr()
主键对应的值,原子减量
|
void |
delay()
尝试延期
|
void |
delay(int seconds)
尝试延期
|
Boolean |
delete()
主键删除
|
Long |
deleteKeys(Collection<String> keys)
删除一批主键
|
Boolean |
exists()
主键是否存在
|
Long |
existsKeys(Collection<String> keys)
检查一批主键是否存在
|
RedisSession |
expire(int seconds)
设置超时(一般跟在 key 后面)
|
long |
geoAdd(double lng,
double lat,
String member) |
long |
geoAddAll(Map<String,redis.clients.jedis.GeoCoordinate> memberMap) |
long |
geoDist(String member1,
String member2) |
List<redis.clients.jedis.resps.GeoRadiusResponse> |
geoGetByRadius(double centerLng,
double centerLat,
long radius) |
String |
get()
获取主键对应的值
|
long |
getAsLong()
获取主键对应的值,并转为长整型
|
List<String> |
getMore(String... keys)
获取多个主键值
|
long |
hashDel(String... fields)
哈希字段删除
|
String |
hashGet(String field)
哈希字段获取
|
LocalHash |
hashGetAll()
哈希获取所有字段
|
Set<String> |
hashGetAllKeys()
哈希获取所有字段名
|
List<String> |
hashGetAllValues()
哈希获取所有字段值
|
long |
hashGetAsLong(String field)
哈希字段获取并转为长整型
|
List<String> |
hashGetMore(String... fields)
哈希字段多个获取
|
Boolean |
hashHas(String field) |
long |
hashIncr(String field,
long num)
哈希字段增量操作
|
long |
hashLen()
哈希长度
|
boolean |
hashMatch(String fieldPattern)
哈希字段匹配
|
List<Map.Entry<String,String>> |
hashScan(String fieldPattern,
int count)
哈希字段扫描
|
RedisSession |
hashSet(String field,
long val)
哈希字段设置
|
RedisSession |
hashSet(String field,
String val)
哈希字段设置
|
RedisSession |
hashSetAll(Map<String,String> map)
哈希字段批量设置
|
long |
incr()
主键对应的值,原子增量
|
long |
incr(long num)
主键对应的值,原子增量
|
redis.clients.jedis.UnifiedJedis |
jedis()
获取jedis原始对象
|
RedisSession |
key(String key)
主键
|
Set<String> |
keys(String pattern)
获取主键
|
RedisSession |
listAdd(long item)
列表添加项
|
RedisSession |
listAdd(String item)
列表添加项
|
RedisSession |
listAddRange(Collection<? extends String> items)
列表批量添加项
|
RedisSession |
listDel(String item)
列表删除项
|
RedisSession |
listDel(String item,
int count)
列表删除项
count > 0 : 从表头开始向表尾搜索,移除与 VALUE 相等的元素,数量为 COUNT 。
|
RedisSession |
listDelRange(Collection<? extends String> items) |
String |
listGet(int index)
列表获取项(先进先出,从right 取)
|
List<String> |
listGetAll() |
List<String> |
listGetRange(int start,
int end)
列表分页获取项(先进先出,从right取)
|
long |
listLen()
列表长度
|
String |
listPeek()
列表预览
|
String |
listPop()
列表冒出
|
RedisSession |
listSet(int index,
String newValue)
列表设置位置对应的项
|
boolean |
lock()
主键尝试锁
|
boolean |
lock(String val)
主键尝试锁一个值
|
boolean |
match(String keyPattern)
主键匹配
|
RedisSession |
persist()
设置为持续存在(即不超时)
|
long |
publish(String channel,
String message) |
void |
rename(String newKey)
主键重命名
|
List<String> |
scan(String keyPattern,
int count)
主键扫描
|
RedisSession |
set(long val)
设置主键对应的值
|
RedisSession |
set(String val)
设置主键对应的值
|
long |
setAdd(String item) |
RedisSession |
setAddRange(Collection<String> items) |
long |
setDel(String item) |
List<String> |
setGet(int count) |
long |
setLen() |
boolean |
setMatch(String itemPattern) |
String |
setPop() |
List<String> |
setScan(String itemPattern,
int count) |
void |
subscribe(redis.clients.jedis.JedisPubSub jedisPubSub,
String... channels) |
long |
ttl()
获取剩余时间
|
RedisSession |
zsetAdd(double score,
String item) |
long |
zsetDel(String... items) |
Collection<String> |
zsetGet(long start,
long end) |
long |
zsetIdx(String item) |
long |
zsetLen() |
boolean |
zsetMatch(String itemPattern) |
List<redis.clients.jedis.resps.Tuple> |
zsetScan(String itemPattern,
int count) |
void close()
throws Exception
close 在接口中 AutoCloseableExceptionredis.clients.jedis.UnifiedJedis jedis()
Long deleteKeys(Collection<String> keys)
Long existsKeys(Collection<String> keys)
RedisSession key(String key)
RedisSession expire(int seconds)
seconds - 秒数(+num 过期秒数;-1永不过期)RedisSession persist()
void delay()
void delay(int seconds)
boolean match(String keyPattern)
keyPattern - 模式(?表示1+, *表示0+)Boolean exists()
Boolean delete()
void rename(String newKey)
long ttl()
RedisSession set(String val)
RedisSession set(long val)
String get()
long getAsLong()
long incr(long num)
long incr()
long decr()
boolean lock(String val)
boolean lock()
List<Map.Entry<String,String>> hashScan(String fieldPattern, int count)
fieldPattern - 字段模式(?表示1+, *表示0+)boolean hashMatch(String fieldPattern)
long hashDel(String... fields)
RedisSession hashSet(String field, String val)
RedisSession hashSet(String field, long val)
RedisSession hashSetAll(Map<String,String> map)
long hashIncr(String field, long num)
long hashGetAsLong(String field)
LocalHash hashGetAll()
long hashLen()
RedisSession listAdd(String item)
RedisSession listAdd(long item)
RedisSession listSet(int index, String newValue)
RedisSession listDel(String item, int count)
count > 0 : 从表头开始向表尾搜索,移除与 VALUE 相等的元素,数量为 COUNT 。 count < 0 : 从表尾开始向表头搜索,移除与 VALUE 相等的元素,数量为 COUNT 的绝对值。 count = 0 : 移除表中所有与 VALUE 相等的值。
RedisSession listDel(String item)
RedisSession listDelRange(Collection<? extends String> items)
RedisSession listAddRange(Collection<? extends String> items)
String listPop()
String listPeek()
String listGet(int index)
long listLen()
long setAdd(String item)
long setDel(String item)
RedisSession setAddRange(Collection<String> items)
long setLen()
String setPop()
boolean setMatch(String itemPattern)
RedisSession zsetAdd(double score, String item)
long zsetDel(String... items)
long zsetLen()
Collection<String> zsetGet(long start, long end)
long zsetIdx(String item)
boolean zsetMatch(String itemPattern)
long geoAdd(double lng,
double lat,
String member)
List<redis.clients.jedis.resps.GeoRadiusResponse> geoGetByRadius(double centerLng, double centerLat, long radius)
void subscribe(redis.clients.jedis.JedisPubSub jedisPubSub,
String... channels)
Copyright © 2022. All rights reserved.