Documentation ¶
Index ¶
- Constants
- Variables
- func GetBucketId(key []byte, bit int) []byte
- func GetSort(sort GeoEnum) string
- type Client
- func (c *Client) Close() error
- func (c *Client) Delete(key string) bool
- func (c *Client) GetExpire(key string) (time.Duration, error)
- func (c *Client) GetGeoOps() Geo
- func (c *Client) GetHashOps() Hash
- func (c *Client) GetKVOps() KV
- func (c *Client) GetListOps() List
- func (c *Client) GetLockOps() Lock
- func (c *Client) GetSetOps() Set
- func (c *Client) GetZSetOps() ZSet
- func (c *Client) HasKey(key string) bool
- func (c *Client) Ping() (string, error)
- func (c *Client) RandomKey() (string, error)
- func (c *Client) SetExpire(key string, expiration time.Duration) (bool, error)
- func (c *Client) SetSerializer(serializer ISerializer)
- type Geo
- func (geo *Geo) GeoAdd(key string, longitude float64, latitude float64, member string) int64
- func (geo *Geo) GeoAddArr(key string, geoPosition []GeoPosition) int64
- func (geo *Geo) GeoDist(key string, member1, member2 string, unit GeoUnit) (error, GeoDistInfo)
- func (geo *Geo) GeoPos(key string, member string) (err error, geoRes GeoPosition)
- func (geo *Geo) GeoPosArr(key string, members []string) (err error, geoRes []GeoPosition)
- func (geo *Geo) GeoRadius(key string, query GeoRadiusQuery) (error, []GeoPosition)
- func (geo *Geo) GeoRadiusByMember(key string, query GeoRadiusByMemberQuery) (error, []GeoPosition)
- type GeoDistInfo
- type GeoEnum
- type GeoPosition
- type GeoRadiusByMemberQuery
- type GeoRadiusQuery
- type GeoUnit
- type GoRedisClusterOps
- type GoRedisStandaloneOps
- func (ops *GoRedisStandaloneOps) Append(key string, value string) (int64, error)
- func (ops *GoRedisStandaloneOps) Close() error
- func (ops *GoRedisStandaloneOps) DeleteKey(keys ...string) (int64, error)
- func (ops *GoRedisStandaloneOps) Exists(key string) (bool, error)
- func (ops *GoRedisStandaloneOps) GeoAddArr(key string, geoLocation ...GeoPosition) int64
- func (ops *GoRedisStandaloneOps) GeoDist(key string, member1, member2 string, unit GeoUnit) (error, GeoDistInfo)
- func (ops *GoRedisStandaloneOps) GeoPos(key string, members ...string) (error, []GeoPosition)
- func (ops *GoRedisStandaloneOps) GeoRadius(key string, query GeoRadiusQuery) (error, []GeoPosition)
- func (ops *GoRedisStandaloneOps) GeoRadiusByMember(key string, member string, query GeoRadiusByMemberQuery) (error, []GeoPosition)
- func (ops *GoRedisStandaloneOps) Get(key string) (string, error)
- func (ops *GoRedisStandaloneOps) GetRange(key string, start int64, end int64) (string, error)
- func (ops *GoRedisStandaloneOps) GetValue(key string) ([]byte, error)
- func (ops *GoRedisStandaloneOps) HDel(key string, fields ...string) (int64, error)
- func (ops *GoRedisStandaloneOps) HExists(key string, field string) (bool, error)
- func (ops *GoRedisStandaloneOps) HGet(key string, field string) (string, error)
- func (ops *GoRedisStandaloneOps) HGetAll(key string) (map[string]string, error)
- func (ops *GoRedisStandaloneOps) HGetFloat64(key string, field string) (float64, error)
- func (ops *GoRedisStandaloneOps) HGetInt64(key string, field string) (int64, error)
- func (ops *GoRedisStandaloneOps) HIncrBy(key string, field string, increment int64) (int64, error)
- func (ops *GoRedisStandaloneOps) HKeys(key string) ([]string, error)
- func (ops *GoRedisStandaloneOps) HLen(key string) (int64, error)
- func (ops *GoRedisStandaloneOps) HMGet(key string, fields ...string) ([]interface{}, error)
- func (ops *GoRedisStandaloneOps) HSet(key string, field string, value interface{}) (int64, error)
- func (ops *GoRedisStandaloneOps) HSetNX(key string, field string, value interface{}) (bool, error)
- func (ops *GoRedisStandaloneOps) HVals(key string) ([]string, error)
- func (ops *GoRedisStandaloneOps) IncrBy(key string, step int64) (int64, error)
- func (ops *GoRedisStandaloneOps) LIndex(key string, index int64) (string, error)
- func (ops *GoRedisStandaloneOps) LPop(key string) (string, error)
- func (ops *GoRedisStandaloneOps) LPush(key string, values ...interface{}) (int64, error)
- func (ops *GoRedisStandaloneOps) LRange(key string, start int64, end int64) ([]string, error)
- func (ops *GoRedisStandaloneOps) LRemove(key string, count int64, value interface{}) (int64, error)
- func (ops *GoRedisStandaloneOps) LSet(key string, index int64, value interface{}) error
- func (ops *GoRedisStandaloneOps) LSize(key string) (int64, error)
- func (ops *GoRedisStandaloneOps) LTrim(key string, start int64, end int64) error
- func (ops *GoRedisStandaloneOps) MultiGet(key ...string) ([]interface{}, error)
- func (ops *GoRedisStandaloneOps) MultiSet(values ...interface{}) error
- func (ops *GoRedisStandaloneOps) Ping() (string, error)
- func (ops *GoRedisStandaloneOps) RPop(key string) (string, error)
- func (ops *GoRedisStandaloneOps) RPush(key string, values ...interface{}) (int64, error)
- func (ops *GoRedisStandaloneOps) RandomKey() (string, error)
- func (ops *GoRedisStandaloneOps) SAdd(key string, members ...interface{}) (int64, error)
- func (ops *GoRedisStandaloneOps) SCard(key string) (int64, error)
- func (ops *GoRedisStandaloneOps) SDiff(keys ...string) ([]string, error)
- func (ops *GoRedisStandaloneOps) SInter(keys ...string) ([]string, error)
- func (ops *GoRedisStandaloneOps) SInterStore(destination string, keys ...string) (int64, error)
- func (ops *GoRedisStandaloneOps) SIsMember(key string, member interface{}) (bool, error)
- func (ops *GoRedisStandaloneOps) SMembers(key string) ([]string, error)
- func (ops *GoRedisStandaloneOps) SMove(source string, destination string, member interface{}) (bool, error)
- func (ops *GoRedisStandaloneOps) SPop(key string) (string, error)
- func (ops *GoRedisStandaloneOps) SRandMembers(key string, count int64) ([]string, error)
- func (ops *GoRedisStandaloneOps) SRem(key string, members ...interface{}) (int64, error)
- func (ops *GoRedisStandaloneOps) SUnion(keys ...string) ([]string, error)
- func (ops *GoRedisStandaloneOps) SUnionStore(destination string, keys ...string) (int64, error)
- func (ops *GoRedisStandaloneOps) Set(key string, value string, expiration time.Duration) error
- func (ops *GoRedisStandaloneOps) SetExpire(key string, expiration time.Duration) (bool, error)
- func (ops *GoRedisStandaloneOps) SetNX(key string, value interface{}) (bool, error)
- func (ops *GoRedisStandaloneOps) SetValue(key string, value interface{}, expiration time.Duration) error
- func (ops *GoRedisStandaloneOps) StrLen(key string) (int64, error)
- func (ops *GoRedisStandaloneOps) TTL(key string) (time.Duration, error)
- func (ops *GoRedisStandaloneOps) ZAdd(key string, member ZMember) int64
- func (ops *GoRedisStandaloneOps) ZCard(key string) int64
- func (ops *GoRedisStandaloneOps) ZCount(key, min, max string) int64
- func (ops *GoRedisStandaloneOps) ZIncrby(key string, incr float64, member string) float64
- func (ops *GoRedisStandaloneOps) ZInterStore(destination string, store []ZStore, arg ZStoreEnum) int64
- func (ops *GoRedisStandaloneOps) ZLexCount(key, min, max string) int64
- func (ops *GoRedisStandaloneOps) ZRange(key string, start, stop int64) []string
- func (ops *GoRedisStandaloneOps) ZRangeByLex(key, min, max string, offset int64, count int64) []string
- func (ops *GoRedisStandaloneOps) ZRangeByScore(key, min, max string, offset int64, count int64) []string
- func (ops *GoRedisStandaloneOps) ZRank(key, member string) int64
- func (ops *GoRedisStandaloneOps) ZRem(key string, member ...string) int64
- func (ops *GoRedisStandaloneOps) ZRemRangeByLex(key, min, max string) int64
- func (ops *GoRedisStandaloneOps) ZRemRangeByRank(key string, start, stop int64) int64
- func (ops *GoRedisStandaloneOps) ZRevRange(key string, start, stop int64) []string
- func (ops *GoRedisStandaloneOps) ZRevRangeWithScores(key string, start, stop int64) ([]ZMember, error)
- func (ops *GoRedisStandaloneOps) ZRevRank(key, member string) int64
- func (ops *GoRedisStandaloneOps) ZScore(key, member string) float64
- type Hash
- func (h Hash) Delete(key string, hashKey string) error
- func (h Hash) Exists(key string, hashKey string) bool
- func (h Hash) Get(key string, hashKey string, value interface{}) error
- func (h Hash) GetEntries(key string) (map[string]string, error)
- func (h Hash) GetHashKeys(key string) ([]string, error)
- func (h Hash) GetString(key string, hashKey string) (string, error)
- func (h Hash) Increment(key string, hashKey string, delta int64) int64
- func (h Hash) MultiGet(key string, hashKeys ...string) ([]interface{}, error)
- func (h Hash) Put(key string, hashKey string, value interface{}) error
- func (h Hash) PutIfAbsent(key string, hashKey string, value interface{}) (bool, error)
- func (h Hash) Size(key string) int64
- type IClient
- type ISerializer
- type JsonSerializer
- type KV
- func (kv KV) Append(key string, value string) int64
- func (kv KV) Get(key string, ptr interface{}) error
- func (kv KV) GetAndSet(key string, value string) (string, error)
- func (kv KV) GetString(key string) (string, error)
- func (kv KV) Increment(key string, delta int64) (int64, error)
- func (kv KV) MultiGet(keys ...string) ([]interface{}, error)
- func (kv KV) MultiSet(values ...interface{}) error
- func (kv KV) Set(key string, value interface{}, duration time.Duration) error
- func (kv KV) SetIfAbsent(key string, value interface{}) (bool, error)
- func (kv KV) SetString(key string, value string, duration time.Duration) error
- type List
- func (ls List) AddElements(key string, values ...interface{}) error
- func (ls List) Clear(key string) (bool, error)
- func (ls List) GetElement(key string, index int64, elem interface{}) error
- func (ls List) GetElements(key string, startIndex int64, endIndex int64, elements interface{})
- func (ls List) Index(key string, index int64) (string, error)
- func (ls List) LeftPop(key string) (string, error)
- func (ls List) LeftPush(key string, value ...interface{}) (int64, error)
- func (ls List) Range(key string, start int64, end int64) ([]string, error)
- func (ls List) Remove(key string, count int64, value interface{}) (int64, error)
- func (ls List) RightPop(key string) (string, error)
- func (ls List) RightPush(key string, values ...interface{}) (int64, error)
- func (ls List) Set(key string, index int64, value interface{}) error
- func (ls List) Size(key string) (int64, error)
- func (ls List) Trim(key string, start int64, end int64) error
- type Lock
- type Ops
- type Options
- type Set
- func (set Set) Add(key string, members ...interface{}) (int64, error)
- func (set Set) Difference(keys ...string) ([]string, error)
- func (set Set) Intersect(keys ...string) ([]string, error)
- func (set Set) IntersectAndStore(destination string, keys ...string) (int64, error)
- func (set Set) IsMember(key string, member interface{}) (bool, error)
- func (set Set) Members(key string) ([]string, error)
- func (set Set) Move(source string, destination string, member interface{}) (bool, error)
- func (set Set) Pop(key string) (string, error)
- func (set Set) RandMembers(key string, count int64) ([]string, error)
- func (set Set) Remove(key string, members ...interface{}) (int64, error)
- func (set Set) Size(key string) (int64, error)
- func (set Set) Union(keys ...string) ([]string, error)
- func (set Set) UnionAndStore(destination string, keys ...string) (int64, error)
- type ZMember
- type ZSet
- func (zSet *ZSet) ZAdd(key string, member ZMember) int64
- func (zSet *ZSet) ZCard(key string) int64
- func (zSet *ZSet) ZCount(key string, min, max float64) int64
- func (zSet *ZSet) ZIncrby(key string, incr float64, member string) float64
- func (zSet *ZSet) ZInterStore(destination string, store []ZStore, arg ZStoreEnum) int64
- func (zSet *ZSet) ZLexCount(key, min, max string) int64
- func (zSet *ZSet) ZRange(key string, start, stop int64) []string
- func (zSet *ZSet) ZRangeByLex(key, min, max string, offset int64, count int64) []string
- func (zSet *ZSet) ZRangeByScore(key, min, max string, offset int64, count int64) []string
- func (zSet *ZSet) ZRank(key, member string) int64
- func (zSet *ZSet) ZRem(key string, member ...string) int64
- func (zSet *ZSet) ZRemRangeByLex(key, min, max string) int64
- func (zSet *ZSet) ZRemRangeByRank(key string, start, stop int64) int64
- func (zSet *ZSet) ZRevRange(key string, start, stop int64) []string
- func (zSet *ZSet) ZRevRangeWithScores(key string, start, stop int64) ([]ZMember, error)
- func (zSet *ZSet) ZRevRank(key, member string) int64
- func (zSet *ZSet) ZScore(key, member string) float64
- type ZStore
- type ZStoreEnum
Constants ¶
const ( KM GeoUnit = "km" M GeoUnit = "m" MI GeoUnit = "mi" FT GeoUnit = "ft" WITHCOORD GeoEnum = "WITHCOORD" WITHDIST GeoEnum = "WITHDIST" WITHHASH GeoEnum = "WITHHASH" ASC GeoEnum = "ASC" DESC GeoEnum = "DESC" )
长度计量单位
const ( LockPrefix = "dlock:" LockValue = "DLOCK" )
Variables ¶
var (
DefaultSerializer = JsonSerializer{}
)
Functions ¶
func GetBucketId ¶
getBucketId
https://www.cnblogs.com/colorfulkoala/p/5783556.html 过程变化简单描述为:get(key1) -> hget(md5(key1), key1) 从而得到value1。 如果我们通过预先计算,让很多key可以在BucketId空间里碰撞,那么可以认为一个BucketId下面挂了多个key。比如平均每个BucketId下面挂10个key,那么理论上我们将会减少超过90%的redis key的个数。 具体实现起来有一些麻烦,而且用这个方法之前你要想好容量规模。我们通常使用的md5是32位的hexString(16进制字符),它的空间是128bit,这个量级太大了,我们需要存储的是百亿级,大约是33bit,所以我们需要有一种机制计算出合适位数的散列,而且为了节约内存,我们需要利用全部字符类型(ASCII码在0~127之间)来填充,而不用HexString,这样Key的长度可以缩短到一半。
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetGeoOps ¶
GetGeoOps Geo Returns the operations performed on geo values (also known GIS system).
func (*Client) GetHashOps ¶
GetHashOps Returns the operations performed on hash values.
func (*Client) GetKVOps ¶
GetKVOps Returns the operations performed on simple values (or Strings in Redis terminology).
func (*Client) GetListOps ¶
GetListOps Returns the operations performed on list values.
func (*Client) GetLockOps ¶
GetLockOps Returns the operations performed on locker values.
func (*Client) GetZSetOps ¶
GetZSetOps Returns the operations performed on zset values (also known as sorted sets).
func (*Client) SetSerializer ¶
func (c *Client) SetSerializer(serializer ISerializer)
SetSerializer set value serializer
type Geo ¶
type Geo struct {
// contains filtered or unexported fields
}
func (*Geo) GeoAddArr ¶
func (geo *Geo) GeoAddArr(key string, geoPosition []GeoPosition) int64
添加一批地理信息
func (*Geo) GeoPos ¶
func (geo *Geo) GeoPos(key string, member string) (err error, geoRes GeoPosition)
根据地理位置名称获取经纬度
func (*Geo) GeoPosArr ¶
func (geo *Geo) GeoPosArr(key string, members []string) (err error, geoRes []GeoPosition)
获取一批地理位置的经纬度
func (*Geo) GeoRadius ¶
func (geo *Geo) GeoRadius(key string, query GeoRadiusQuery) (error, []GeoPosition)
* 经纬度中心距离计算
func (*Geo) GeoRadiusByMember ¶
func (geo *Geo) GeoRadiusByMember(key string, query GeoRadiusByMemberQuery) (error, []GeoPosition)
* 地理标识中心距离计算
type GeoDistInfo ¶
type GeoPosition ¶
type GeoRadiusByMemberQuery ¶
type GeoRadiusQuery ¶
type GoRedisClusterOps ¶
type GoRedisClusterOps struct {
GoRedisStandaloneOps
}
func NewClusterOps ¶
func NewClusterOps(options *Options) *GoRedisClusterOps
type GoRedisStandaloneOps ¶
type GoRedisStandaloneOps struct {
// contains filtered or unexported fields
}
func NewStandaloneOps ¶
func NewStandaloneOps(options *Options) *GoRedisStandaloneOps
func (*GoRedisStandaloneOps) Append ¶
func (ops *GoRedisStandaloneOps) Append(key string, value string) (int64, error)
func (*GoRedisStandaloneOps) Close ¶
func (ops *GoRedisStandaloneOps) Close() error
func (*GoRedisStandaloneOps) DeleteKey ¶
func (ops *GoRedisStandaloneOps) DeleteKey(keys ...string) (int64, error)
func (*GoRedisStandaloneOps) Exists ¶
func (ops *GoRedisStandaloneOps) Exists(key string) (bool, error)
func (*GoRedisStandaloneOps) GeoAddArr ¶
func (ops *GoRedisStandaloneOps) GeoAddArr(key string, geoLocation ...GeoPosition) int64
func (*GoRedisStandaloneOps) GeoDist ¶
func (ops *GoRedisStandaloneOps) GeoDist(key string, member1, member2 string, unit GeoUnit) (error, GeoDistInfo)
func (*GoRedisStandaloneOps) GeoPos ¶
func (ops *GoRedisStandaloneOps) GeoPos(key string, members ...string) (error, []GeoPosition)
func (*GoRedisStandaloneOps) GeoRadius ¶
func (ops *GoRedisStandaloneOps) GeoRadius(key string, query GeoRadiusQuery) (error, []GeoPosition)
func (*GoRedisStandaloneOps) GeoRadiusByMember ¶
func (ops *GoRedisStandaloneOps) GeoRadiusByMember(key string, member string, query GeoRadiusByMemberQuery) (error, []GeoPosition)
func (*GoRedisStandaloneOps) GetValue ¶
func (ops *GoRedisStandaloneOps) GetValue(key string) ([]byte, error)
func (*GoRedisStandaloneOps) HDel ¶
func (ops *GoRedisStandaloneOps) HDel(key string, fields ...string) (int64, error)
func (*GoRedisStandaloneOps) HExists ¶
func (ops *GoRedisStandaloneOps) HExists(key string, field string) (bool, error)
func (*GoRedisStandaloneOps) HGet ¶
func (ops *GoRedisStandaloneOps) HGet(key string, field string) (string, error)
func (*GoRedisStandaloneOps) HGetAll ¶
func (ops *GoRedisStandaloneOps) HGetAll(key string) (map[string]string, error)
func (*GoRedisStandaloneOps) HGetFloat64 ¶
func (ops *GoRedisStandaloneOps) HGetFloat64(key string, field string) (float64, error)
func (*GoRedisStandaloneOps) HGetInt64 ¶
func (ops *GoRedisStandaloneOps) HGetInt64(key string, field string) (int64, error)
func (*GoRedisStandaloneOps) HKeys ¶
func (ops *GoRedisStandaloneOps) HKeys(key string) ([]string, error)
func (*GoRedisStandaloneOps) HLen ¶
func (ops *GoRedisStandaloneOps) HLen(key string) (int64, error)
func (*GoRedisStandaloneOps) HMGet ¶
func (ops *GoRedisStandaloneOps) HMGet(key string, fields ...string) ([]interface{}, error)
func (*GoRedisStandaloneOps) HSet ¶
func (ops *GoRedisStandaloneOps) HSet(key string, field string, value interface{}) (int64, error)
func (*GoRedisStandaloneOps) HSetNX ¶
func (ops *GoRedisStandaloneOps) HSetNX(key string, field string, value interface{}) (bool, error)
func (*GoRedisStandaloneOps) HVals ¶
func (ops *GoRedisStandaloneOps) HVals(key string) ([]string, error)
func (*GoRedisStandaloneOps) IncrBy ¶
func (ops *GoRedisStandaloneOps) IncrBy(key string, step int64) (int64, error)
func (*GoRedisStandaloneOps) LIndex ¶
func (ops *GoRedisStandaloneOps) LIndex(key string, index int64) (string, error)
func (*GoRedisStandaloneOps) LPop ¶
func (ops *GoRedisStandaloneOps) LPop(key string) (string, error)
--------------------------------------------------------------------------------------------------- list ops
func (*GoRedisStandaloneOps) LPush ¶
func (ops *GoRedisStandaloneOps) LPush(key string, values ...interface{}) (int64, error)
func (*GoRedisStandaloneOps) LRemove ¶
func (ops *GoRedisStandaloneOps) LRemove(key string, count int64, value interface{}) (int64, error)
func (*GoRedisStandaloneOps) LSet ¶
func (ops *GoRedisStandaloneOps) LSet(key string, index int64, value interface{}) error
func (*GoRedisStandaloneOps) LSize ¶
func (ops *GoRedisStandaloneOps) LSize(key string) (int64, error)
func (*GoRedisStandaloneOps) LTrim ¶
func (ops *GoRedisStandaloneOps) LTrim(key string, start int64, end int64) error
func (*GoRedisStandaloneOps) MultiGet ¶
func (ops *GoRedisStandaloneOps) MultiGet(key ...string) ([]interface{}, error)
func (*GoRedisStandaloneOps) MultiSet ¶
func (ops *GoRedisStandaloneOps) MultiSet(values ...interface{}) error
MultiSet is like Set but accepts multiple values:
- MSet("key1", "value1", "key2", "value2")
- MSet([]string{"key1", "value1", "key2", "value2"})
- MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (*GoRedisStandaloneOps) Ping ¶
func (ops *GoRedisStandaloneOps) Ping() (string, error)
func (*GoRedisStandaloneOps) RPop ¶
func (ops *GoRedisStandaloneOps) RPop(key string) (string, error)
func (*GoRedisStandaloneOps) RPush ¶
func (ops *GoRedisStandaloneOps) RPush(key string, values ...interface{}) (int64, error)
func (*GoRedisStandaloneOps) RandomKey ¶
func (ops *GoRedisStandaloneOps) RandomKey() (string, error)
func (*GoRedisStandaloneOps) SAdd ¶
func (ops *GoRedisStandaloneOps) SAdd(key string, members ...interface{}) (int64, error)
func (*GoRedisStandaloneOps) SCard ¶
func (ops *GoRedisStandaloneOps) SCard(key string) (int64, error)
func (*GoRedisStandaloneOps) SDiff ¶
func (ops *GoRedisStandaloneOps) SDiff(keys ...string) ([]string, error)
func (*GoRedisStandaloneOps) SInter ¶
func (ops *GoRedisStandaloneOps) SInter(keys ...string) ([]string, error)
func (*GoRedisStandaloneOps) SInterStore ¶
func (ops *GoRedisStandaloneOps) SInterStore(destination string, keys ...string) (int64, error)
func (*GoRedisStandaloneOps) SIsMember ¶
func (ops *GoRedisStandaloneOps) SIsMember(key string, member interface{}) (bool, error)
func (*GoRedisStandaloneOps) SMembers ¶
func (ops *GoRedisStandaloneOps) SMembers(key string) ([]string, error)
func (*GoRedisStandaloneOps) SMove ¶
func (ops *GoRedisStandaloneOps) SMove(source string, destination string, member interface{}) (bool, error)
func (*GoRedisStandaloneOps) SPop ¶
func (ops *GoRedisStandaloneOps) SPop(key string) (string, error)
func (*GoRedisStandaloneOps) SRandMembers ¶
func (ops *GoRedisStandaloneOps) SRandMembers(key string, count int64) ([]string, error)
func (*GoRedisStandaloneOps) SRem ¶
func (ops *GoRedisStandaloneOps) SRem(key string, members ...interface{}) (int64, error)
func (*GoRedisStandaloneOps) SUnion ¶
func (ops *GoRedisStandaloneOps) SUnion(keys ...string) ([]string, error)
func (*GoRedisStandaloneOps) SUnionStore ¶
func (ops *GoRedisStandaloneOps) SUnionStore(destination string, keys ...string) (int64, error)
func (*GoRedisStandaloneOps) SetNX ¶
func (ops *GoRedisStandaloneOps) SetNX(key string, value interface{}) (bool, error)
func (*GoRedisStandaloneOps) SetValue ¶
func (ops *GoRedisStandaloneOps) SetValue(key string, value interface{}, expiration time.Duration) error
func (*GoRedisStandaloneOps) StrLen ¶
func (ops *GoRedisStandaloneOps) StrLen(key string) (int64, error)
func (*GoRedisStandaloneOps) TTL ¶
func (ops *GoRedisStandaloneOps) TTL(key string) (time.Duration, error)
func (*GoRedisStandaloneOps) ZAdd ¶
func (ops *GoRedisStandaloneOps) ZAdd(key string, member ZMember) int64
func (*GoRedisStandaloneOps) ZCard ¶
func (ops *GoRedisStandaloneOps) ZCard(key string) int64
func (*GoRedisStandaloneOps) ZCount ¶
func (ops *GoRedisStandaloneOps) ZCount(key, min, max string) int64
func (*GoRedisStandaloneOps) ZIncrby ¶
func (ops *GoRedisStandaloneOps) ZIncrby(key string, incr float64, member string) float64
func (*GoRedisStandaloneOps) ZInterStore ¶
func (ops *GoRedisStandaloneOps) ZInterStore(destination string, store []ZStore, arg ZStoreEnum) int64
func (*GoRedisStandaloneOps) ZLexCount ¶
func (ops *GoRedisStandaloneOps) ZLexCount(key, min, max string) int64
func (*GoRedisStandaloneOps) ZRange ¶
func (ops *GoRedisStandaloneOps) ZRange(key string, start, stop int64) []string
func (*GoRedisStandaloneOps) ZRangeByLex ¶
func (ops *GoRedisStandaloneOps) ZRangeByLex(key, min, max string, offset int64, count int64) []string
func (*GoRedisStandaloneOps) ZRangeByScore ¶
func (ops *GoRedisStandaloneOps) ZRangeByScore(key, min, max string, offset int64, count int64) []string
func (*GoRedisStandaloneOps) ZRank ¶
func (ops *GoRedisStandaloneOps) ZRank(key, member string) int64
func (*GoRedisStandaloneOps) ZRem ¶
func (ops *GoRedisStandaloneOps) ZRem(key string, member ...string) int64
func (*GoRedisStandaloneOps) ZRemRangeByLex ¶
func (ops *GoRedisStandaloneOps) ZRemRangeByLex(key, min, max string) int64
func (*GoRedisStandaloneOps) ZRemRangeByRank ¶
func (ops *GoRedisStandaloneOps) ZRemRangeByRank(key string, start, stop int64) int64
func (*GoRedisStandaloneOps) ZRevRange ¶
func (ops *GoRedisStandaloneOps) ZRevRange(key string, start, stop int64) []string
func (*GoRedisStandaloneOps) ZRevRangeWithScores ¶
func (ops *GoRedisStandaloneOps) ZRevRangeWithScores(key string, start, stop int64) ([]ZMember, error)
func (*GoRedisStandaloneOps) ZRevRank ¶
func (ops *GoRedisStandaloneOps) ZRevRank(key, member string) int64
func (*GoRedisStandaloneOps) ZScore ¶
func (ops *GoRedisStandaloneOps) ZScore(key, member string) float64
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
func (Hash) GetEntries ¶
GetEntries get all hash keys and values
func (Hash) GetHashKeys ¶
GetHashKeys get hask keys for the key
func (Hash) PutIfAbsent ¶
Put put value (struct , int64, float64) to the key and hash key; cmd by SetNx .
type IClient ¶
type IClient interface { //SetSerializer set value serializer SetSerializer(ISerializer) //GetKVOps Returns the operations performed on simple values (or Strings in Redis terminology). GetKVOps() KV //GetListOps Returns the operations performed on list values. GetListOps() List //GetHashOps Returns the operations performed on hash values. GetHashOps() Hash //GetSetOps Returns the operations performed on set values. GetSetOps() Set //GetZSetOps Returns the operations performed on zset values (also known as sorted sets). GetZSetOps() ZSet //GetGeoOps Geo Returns the operations performed on geo values (also known GIS system). GetGeoOps() Geo //GetLockOps Returns the operations performed on locker values. GetLockOps() Lock Close() error // SetExpire cmd by expire Ping() (string, error) // SetExpire cmd by expire SetExpire(key string, expiration time.Duration) (bool, error) // SetExpire cmd by TTL GetExpire(key string) (time.Duration, error) // Delete delete the key, cmd by del Delete(key string) bool // HasKey exists the key, cmd by exists HasKey(key string) bool // RandomKey return random Key for db RandomKey() (string, error) }
IClient redis client interface
type ISerializer ¶
type JsonSerializer ¶
type JsonSerializer struct { }
func (JsonSerializer) Deserialization ¶
func (serializer JsonSerializer) Deserialization(byt []byte, ptr interface{}) (err error)
func (JsonSerializer) Serialization ¶
func (serializer JsonSerializer) Serialization(value interface{}) ([]byte, error)
type KV ¶
type KV struct {
// contains filtered or unexported fields
}
func (KV) GetAndSet ¶
GetAndSet get value for the key , and that if it's null, set value to the key.
func (KV) MultiSet ¶
MultiSet is like Set but accepts multiple values:
- MSet("key1", "value1", "key2", "value2")
- MSet([]string{"key1", "value1", "key2", "value2"})
- MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (KV) SetIfAbsent ¶
Set set serialization object to the key, redis cmd: setnx
type List ¶
type List struct {
// contains filtered or unexported fields
}
the List elements type is string
func (List) AddElements ¶
AddElements add serialization elements to key list
func (List) GetElement ¶
GetElement get serialization element for key list
func (List) GetElements ¶
GetElements get serialization elements for key list
type Ops ¶
type Ops interface { Close() error Ping() (string, error) DeleteKey(keys ...string) (int64, error) Exists(key string) (bool, error) SetExpire(key string, expiration time.Duration) (bool, error) TTL(key string) (time.Duration, error) MultiSet(values ...interface{}) error SetValue(key string, value interface{}, expiration time.Duration) error Set(key string, value string, expiration time.Duration) error SetNX(key string, value interface{}) (bool, error) Get(key string) (string, error) GetValue(key string) ([]byte, error) Append(key string, value string) (int64, error) StrLen(key string) (int64, error) GetRange(key string, start int64, end int64) (string, error) RandomKey() (string, error) MultiGet(key ...string) ([]interface{}, error) IncrBy(key string, step int64) (int64, error) LIndex(key string, index int64) (string, error) LPop(key string) (string, error) LPush(key string, values ...interface{}) (int64, error) LRange(key string, start int64, end int64) ([]string, error) LTrim(key string, start int64, end int64) error RPop(key string) (string, error) RPush(key string, values ...interface{}) (int64, error) LSet(key string, index int64, value interface{}) error LSize(key string) (int64, error) LRemove(key string, count int64, value interface{}) (int64, error) GeoAddArr(key string, geoLocation ...GeoPosition) int64 GeoPos(key string, members ...string) (error, []GeoPosition) GeoDist(key string, member1, member2 string, unit GeoUnit) (error, GeoDistInfo) GeoRadius(key string, query GeoRadiusQuery) (error, []GeoPosition) GeoRadiusByMember(key string, member string, query GeoRadiusByMemberQuery) (error, []GeoPosition) SAdd(key string, members ...interface{}) (int64, error) SDiff(keys ...string) ([]string, error) SCard(key string) (int64, error) SInter(keys ...string) ([]string, error) SInterStore(destination string, keys ...string) (int64, error) SIsMember(key string, member interface{}) (bool, error) SMembers(key string) ([]string, error) SMove(source string, destination string, member interface{}) (bool, error) SPop(key string) (string, error) SRandMembers(key string, count int64) ([]string, error) SRem(key string, members ...interface{}) (int64, error) SUnion(keys ...string) ([]string, error) SUnionStore(destination string, keys ...string) (int64, error) HDel(key string, fields ...string) (int64, error) HExists(key string, field string) (bool, error) HGet(key string, field string) (string, error) HGetAll(key string) (map[string]string, error) HIncrBy(key string, field string, increment int64) (int64, error) HKeys(key string) ([]string, error) HLen(key string) (int64, error) HMGet(key string, fields ...string) ([]interface{}, error) HSet(key string, field string, value interface{}) (int64, error) HSetNX(key string, field string, value interface{}) (bool, error) HVals(key string) ([]string, error) ZAdd(key string, member ZMember) int64 ZCard(key string) int64 ZCount(key, min, max string) int64 ZIncrby(key string, incr float64, member string) float64 ZInterStore(destination string, store []ZStore, arg ZStoreEnum) int64 ZLexCount(key, min, max string) int64 ZRange(key string, start, stop int64) []string ZRangeByLex(key, min, max string, offset int64, count int64) []string ZRangeByScore(key, min, max string, offset int64, count int64) []string ZRank(key, member string) int64 ZRem(key string, member ...string) int64 ZRemRangeByLex(key, min, max string) int64 ZRemRangeByRank(key string, start, stop int64) int64 ZRevRange(key string, start, stop int64) []string ZRevRangeWithScores(key string, start, stop int64) ([]ZMember, error) ZRevRank(key, member string) int64 ZScore(key, member string) float64 }
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
func (Set) IntersectAndStore ¶
type ZSet ¶
type ZSet struct {
// contains filtered or unexported fields
}
func (*ZSet) ZInterStore ¶
func (zSet *ZSet) ZInterStore(destination string, store []ZStore, arg ZStoreEnum) int64
func (*ZSet) ZRangeByLex ¶
func (*ZSet) ZRangeByScore ¶
func (*ZSet) ZRemRangeByLex ¶
func (*ZSet) ZRemRangeByRank ¶
func (*ZSet) ZRevRangeWithScores ¶
type ZStoreEnum ¶
type ZStoreEnum string
const ( MAX ZStoreEnum = "MAX" MIN ZStoreEnum = "MIN" SUM ZStoreEnum = "SUM" )