public abstract class RedisBase extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
groupName |
protected byte[] |
key |
protected static String |
KEY_SUFFIX_SPLIT |
protected static org.slf4j.Logger |
logger |
protected String |
origKey |
protected static String |
RESP_OK |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
exists()
检查给定 key 是否存在。
|
static long |
getDefaultExpireSeconds()
默认过期时间
|
byte[] |
getKey() |
Long |
getTtl()
返回给定 key 的剩余生存时间
|
protected <T> List<T> |
listDerialize(List<byte[]> datas) |
boolean |
remove()
删除给定的一个 key 。
|
boolean |
removeExpire()
移除给定 key 的生存时间,设置为永久有效
|
boolean |
setExpire(long seconds)
为给定 key 设置生存时间,当 key 过期时(生存时间为 0 ),它会被自动删除。
|
boolean |
setExpireAt(Date expireAt)
设置指定时间戳时失效
注意:redis服务器时间问题
|
boolean |
setExpireIfNot(long seconds)
没设置过期时间则设置
|
String |
type()
返回 key 所储存的值的类型。
|
protected <T> T |
valueDerialize(byte[] bytes) |
protected byte[] |
valueSerialize(Object value) |
protected byte[][] |
valuesSerialize(Object... objects) |
protected static final org.slf4j.Logger logger
protected String groupName
protected byte[] key
protected String origKey
public RedisBase(String key)
public byte[] getKey()
public boolean exists()
key - public boolean remove()
key - public boolean setExpire(long seconds)
key - seconds - 超时时间,单位:秒public boolean setExpireAt(Date expireAt)
key - expireAt - 超时时间点public boolean setExpireIfNot(long seconds)
seconds - public Long getTtl()
key - public boolean removeExpire()
key - public String type()
key - protected byte[] valueSerialize(Object value)
protected byte[][] valuesSerialize(Object... objects)
protected <T> T valueDerialize(byte[] bytes)
public static long getDefaultExpireSeconds()
Copyright © 2016. All rights reserved.