Documentation ¶
Index ¶
- Constants
- type Config
- type Pool
- func (p *Pool) HashGet(key, field string) (b []byte, err error)
- func (p *Pool) HashGetString(key, field string) (string, error)
- func (p *Pool) HashHdel(key, field string) (err error)
- func (p *Pool) HashHexists(key, field string) (ok bool)
- func (p *Pool) HashHgetallMapStringInt(key string) (res map[string]int, err error)
- func (p *Pool) HashHgetallMapStringString(key string) (res map[string]string, err error)
- func (p *Pool) HashHincrby(key, field string, incr int) (err error)
- func (p *Pool) HashHkeys(key string) (l []string, err error)
- func (p *Pool) HashHlen(key string) (l int64, err error)
- func (p *Pool) HashHvals(key string) (l []string, err error)
- func (p *Pool) HashMget(values ...interface{}) (b []interface{}, err error)
- func (p *Pool) HashMgetMapString(values ...interface{}) (b map[string]string, err error)
- func (p *Pool) HashMgetString(values ...interface{}) (b []string, err error)
- func (p *Pool) HashMset(values ...interface{}) error
- func (p *Pool) HashSet(key, field string, value interface{}) error
- func (p *Pool) KeyDelete(key string) (bool, error)
- func (p *Pool) KeyExists(key string) bool
- func (p *Pool) KeyExpire(key string, time int) (bool, error)
- func (p *Pool) KeyLikeDeletes(key string) error
- func (p *Pool) LockAdd(key, requestId string, ex int) bool
- func (p *Pool) LockDel(key, requestId string) bool
- func (p *Pool) LockGet(key string) string
- func (p *Pool) SetDel(key, value string) error
- func (p *Pool) SetExist(key, value string) bool
- func (p *Pool) SetGetAll(key string) []string
- func (p *Pool) SetPop(key string, count int) []string
- func (p *Pool) SetSet(key, value string) error
- func (p *Pool) SetSetAndExpire(key, value string) error
- func (p *Pool) StringGet(key string) (string, error)
- func (p *Pool) StringGetInt(key string) (int, error)
- func (p *Pool) StringSet(key string, data interface{}, time int) (bool, error)
- func (p *Pool) ZsetSet(key, value string, score int) error
- func (p *Pool) ZsetSetGetASC(key string, start, end int) (list ZsetList, err error)
- func (p *Pool) ZsetSetGetDESC(key string, start, end int) (list ZsetList, err error)
- func (p *Pool) ZsetSetInccr1(key, value string, score int) error
- type Zset
- type ZsetList
Constants ¶
const ( SET_IF_NOT_EXIST = "NX" // 不存在则执行 SET_WITH_EXPIRE_TIME = "EX" // 过期时间(秒) PX 毫秒 SET_LOCK_SUCCESS = "OK" // 操作成功 DEL_LOCK_SUCCESS = 1 // lock 删除成功 DEL_LOCK_NON_EXISTENT = 0 // 删除lock key时,并不存在 )
const (
INCR = "INCR"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶ added in v0.4.5
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) HashGetString ¶ added in v0.4.5
"test","a"
func (*Pool) HashHexists ¶ added in v0.4.5
判断field是否存在 输入 "test", "a" 输出 true or false
func (*Pool) HashHgetallMapStringInt ¶ added in v0.4.5
获取key的全部数据 输入 "test"
func (*Pool) HashHgetallMapStringString ¶ added in v0.4.5
获取key的全部数据 输入 "test"
func (*Pool) HashHincrby ¶ added in v0.4.5
value 增加incr e原来是1,incr=2,完成后e=3 要求 field的值必须是int 若field不存在,则新增field,value=incr 输入 "test", "e",2 输出 true or false
func (*Pool) HashMgetMapString ¶ added in v0.4.5
values 是由 key, k,k,k组成 输入 "test", "a", "b","c","cc","e" 输出 map[string]string{ "a": "aa", "b": "bb", "c": "cc", "cc": "cc", "e": "3" }
func (*Pool) HashMgetString ¶ added in v0.4.5
values 是由 key, k,k,k组成 输入 "test", "a", "b","c" 输出 ["aa","bb","cc"]
func (*Pool) KeyLikeDeletes ¶ added in v0.4.5
func (*Pool) LockAdd ¶ added in v0.4.5
redis 类型 字符串设置一个分布式锁 (哈希内部字段不支持过期判断,redis只支持顶级key过期)
@param key: 锁名,格式为 用户id_操作_方法 @param requestId: 客户端唯一id 用来指定锁不被其他线程(协程)删除 @param ex: 过期时间
func (*Pool) LockDel ¶ added in v0.4.5
删除redis分布式锁
@param key:redis类型字符串的key值 @param requestId: 唯一值id,与value值对比,避免在分布式下其他实例删除该锁
func (*Pool) LockGet ¶ added in v0.4.5
获得redis分布式锁的值
@param key:redis类型字符串的key值 @param return: redis类型字符串的value
func (*Pool) SetSetAndExpire ¶ added in v0.4.6
设置
func (*Pool) ZsetSetGetASC ¶ added in v0.4.5
获取 从低到高
func (*Pool) ZsetSetGetDESC ¶ added in v0.4.5
获取 从高到低