redis

package
v1.9.2802 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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"
)

长度计量单位

View Source
const (
	LockPrefix       = "dlock:"
	LockValue        = "DLOCK"
	DefaultWaitTime  = 10 * time.Second
	DefaultLeaseTime = 30 * time.Second
	WatchdogInterval = 10 * time.Second
)

Variables

View Source
var (
	DefaultSerializer = JsonSerializer{}
)

Functions

func GetBucketId

func GetBucketId(key []byte, bit int) []byte
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的长度可以缩短到一半。

func GetLockFromContext added in v1.9.28

func GetLockFromContext(ctx context.Context) (*lockInfo, bool)

GetLockFromContext retrieves lock info from context

func GetSort

func GetSort(sort GeoEnum) string

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) Close

func (c *Client) Close() error

RandomKey return random Key for db

func (*Client) Delete

func (c *Client) Delete(key string) bool

Delete delete the key, cmd by del

func (*Client) GetExpire

func (c *Client) GetExpire(key string) (time.Duration, error)

SetExpire cmd by TTL

func (*Client) GetGeoOps

func (c *Client) GetGeoOps() Geo

GetGeoOps Geo Returns the operations performed on geo values (also known GIS system).

func (*Client) GetHashOps

func (c *Client) GetHashOps() Hash

GetHashOps Returns the operations performed on hash values.

func (*Client) GetKVOps

func (c *Client) GetKVOps() KV

GetKVOps Returns the operations performed on simple values (or Strings in Redis terminology).

func (*Client) GetListOps

func (c *Client) GetListOps() List

GetListOps Returns the operations performed on list values.

func (*Client) GetLockOps

func (c *Client) GetLockOps() *Lock

GetLockOps Returns the operations performed on locker values.

func (*Client) GetPipeLineOps added in v1.9.28

func (c *Client) GetPipeLineOps() Pipeline

GetPipeLineOps creates a pipeline for batch commands execution

func (*Client) GetPipeline added in v1.9.28

func (c *Client) GetPipeline() Pipeline

GetPipeline creates a pipeline

func (*Client) GetPubSubOps added in v1.9.28

func (c *Client) GetPubSubOps() PubSub

GetPubSubOps Returns the operations performed on publish/subscribe values.

func (*Client) GetSetOps

func (c *Client) GetSetOps() Set

GetSetOps Returns the operations performed on set values.

func (*Client) GetTxPipeLineOps added in v1.9.28

func (c *Client) GetTxPipeLineOps() Pipeline

GetTxPipeLineOps creates a transaction pipeline for batch commands execution

func (*Client) GetTxPipeline added in v1.9.28

func (c *Client) GetTxPipeline() Pipeline

GetTxPipeline creates a transaction pipeline

func (*Client) GetZSetOps

func (c *Client) GetZSetOps() ZSet

GetZSetOps Returns the operations performed on zset values (also known as sorted sets).

func (*Client) HasKey

func (c *Client) HasKey(key string) bool

HasKey exists the key, cmd by exists

func (*Client) Info added in v1.9.6

func (c *Client) Info() (string, error)

func (*Client) ListKeys added in v1.9.6

func (c *Client) ListKeys(page uint64, pattern string, pageSize int64) ([]string, int, error)

func (*Client) Ping

func (c *Client) Ping() (string, error)

Ping return PONG and error

func (*Client) RandomKey

func (c *Client) RandomKey() (string, error)

RandomKey return random Key for db

func (*Client) SetExpire

func (c *Client) SetExpire(key string, expiration time.Duration) (bool, error)

SetExpire cmd by expire

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) GeoAdd

func (geo *Geo) GeoAdd(key string, longitude float64, latitude float64, member string) int64

添加一个地理信息

func (*Geo) GeoAddArr

func (geo *Geo) GeoAddArr(key string, geoPosition []GeoPosition) int64

添加一批地理信息

func (*Geo) GeoDist

func (geo *Geo) GeoDist(key string, member1, member2 string, unit GeoUnit) (error, GeoDistInfo)

* 获取两个坐标的直线距离

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 GeoDistInfo struct {
	Unit GeoUnit
	Dist float64
}

type GeoEnum

type GeoEnum string

type GeoPosition

type GeoPosition struct {
	Longitude float64
	Latitude  float64
	Dist      float64
	Member    string
	GeoHash   int64
	Unit      GeoUnit
}

type GeoRadiusByMemberQuery

type GeoRadiusByMemberQuery struct {
	Member      string
	Radius      float64
	Unit        GeoUnit
	WithCoord   bool
	WithDist    bool
	WithGeoHash bool
	Count       int
	// Can be ASC or DESC. Default is no sort order.
	Sort      GeoEnum
	Store     string
	StoreDist string
}

type GeoRadiusQuery

type GeoRadiusQuery struct {
	Longitude   float64
	Latitude    float64
	Radius      float64
	Unit        GeoUnit
	WithCoord   bool
	WithDist    bool
	WithGeoHash bool
	Count       int
	// Can be ASC or DESC. Default is no sort order.
	Sort      GeoEnum
	Store     string
	StoreDist string
}

type GeoUnit

type GeoUnit string

type GoRedisClusterOps

type GoRedisClusterOps struct {
	GoRedisStandaloneOps
	// contains filtered or unexported fields
}

func NewClusterOps

func NewClusterOps(options *Options, serializer ISerializer) *GoRedisClusterOps

func (*GoRedisClusterOps) Close added in v1.9.28

func (ops *GoRedisClusterOps) Close() error

Close closes the cluster client

func (*GoRedisClusterOps) PSubscribe added in v1.9.28

func (ops *GoRedisClusterOps) PSubscribe(patterns ...string) (*Subscription, error)

PSubscribe subscribes the client to the given patterns

func (*GoRedisClusterOps) Pipeline added in v1.9.28

func (ops *GoRedisClusterOps) Pipeline() Pipeline

Pipeline creates a pipeline for batch commands execution

func (*GoRedisClusterOps) Publish added in v1.9.28

func (ops *GoRedisClusterOps) Publish(channel string, message interface{}) (int64, error)

Publish posts a message to the channel

func (*GoRedisClusterOps) Subscribe added in v1.9.28

func (ops *GoRedisClusterOps) Subscribe(channels ...string) (*Subscription, error)

Subscribe subscribes the client to the specified channels

func (*GoRedisClusterOps) TxPipeline added in v1.9.28

func (ops *GoRedisClusterOps) TxPipeline() Pipeline

TxPipeline creates a transaction pipeline

type GoRedisPipeline added in v1.9.28

type GoRedisPipeline struct {
	// contains filtered or unexported fields
}

GoRedisPipeline 实现 Pipeline 接口

func (*GoRedisPipeline) Del added in v1.9.28

func (p *GoRedisPipeline) Del(keys ...string) *redis.IntCmd

func (*GoRedisPipeline) Discard added in v1.9.28

func (p *GoRedisPipeline) Discard()

func (*GoRedisPipeline) Exec added in v1.9.28

func (p *GoRedisPipeline) Exec(ctx context.Context) ([]redis.Cmder, error)

func (*GoRedisPipeline) Get added in v1.9.28

func (p *GoRedisPipeline) Get(key string) *redis.StringCmd

func (*GoRedisPipeline) HGet added in v1.9.28

func (p *GoRedisPipeline) HGet(key string, field string) *redis.StringCmd

func (*GoRedisPipeline) HSet added in v1.9.28

func (p *GoRedisPipeline) HSet(key string, field string, value interface{}) *redis.IntCmd

func (*GoRedisPipeline) Incr added in v1.9.28

func (p *GoRedisPipeline) Incr(key string) *redis.IntCmd

func (*GoRedisPipeline) IncrBy added in v1.9.28

func (p *GoRedisPipeline) IncrBy(key string, value int64) *redis.IntCmd

func (*GoRedisPipeline) LPush added in v1.9.28

func (p *GoRedisPipeline) LPush(key string, values ...interface{}) *redis.IntCmd

func (*GoRedisPipeline) MGet added in v1.9.28

func (p *GoRedisPipeline) MGet(keys ...string) *redis.SliceCmd

func (*GoRedisPipeline) MSet added in v1.9.28

func (p *GoRedisPipeline) MSet(pairs ...interface{}) *redis.StatusCmd

func (*GoRedisPipeline) RPush added in v1.9.28

func (p *GoRedisPipeline) RPush(key string, values ...interface{}) *redis.IntCmd

func (*GoRedisPipeline) SAdd added in v1.9.28

func (p *GoRedisPipeline) SAdd(key string, members ...interface{}) *redis.IntCmd

func (*GoRedisPipeline) Set added in v1.9.28

func (p *GoRedisPipeline) Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd

func (*GoRedisPipeline) SetNX added in v1.9.28

func (p *GoRedisPipeline) SetNX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd

func (*GoRedisPipeline) ZAdd added in v1.9.28

func (p *GoRedisPipeline) ZAdd(key string, members ...redis.Z) *redis.IntCmd

type GoRedisStandaloneOps

type GoRedisStandaloneOps struct {
	// contains filtered or unexported fields
}

func NewStandaloneOps

func NewStandaloneOps(options *Options, serializer ISerializer) *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) Eval added in v1.9.28

func (ops *GoRedisStandaloneOps) Eval(script string, keys []string, args ...interface{}) (interface{}, error)

Eval executes a Lua script with the given keys and arguments

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) Get

func (ops *GoRedisStandaloneOps) Get(key string) (string, error)

func (*GoRedisStandaloneOps) GetRange

func (ops *GoRedisStandaloneOps) GetRange(key string, start int64, end int64) (string, error)

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) HIncrBy

func (ops *GoRedisStandaloneOps) HIncrBy(key string, field string, increment int64) (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) Info added in v1.9.6

func (ops *GoRedisStandaloneOps) Info() (string, 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) LRange

func (ops *GoRedisStandaloneOps) LRange(key string, start int64, end int64) ([]string, 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) ListKeys added in v1.9.6

func (ops *GoRedisStandaloneOps) ListKeys(page uint64, pattern string, pageSize int64) ([]string, int, 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) PSubscribe added in v1.9.28

func (ops *GoRedisStandaloneOps) PSubscribe(patterns ...string) (*Subscription, error)

PSubscribe subscribes the client to the given patterns

func (*GoRedisStandaloneOps) Ping

func (ops *GoRedisStandaloneOps) Ping() (string, error)

func (*GoRedisStandaloneOps) Pipeline added in v1.9.28

func (ops *GoRedisStandaloneOps) Pipeline() Pipeline

Pipeline creates a pipeline for batch commands execution

func (*GoRedisStandaloneOps) Publish added in v1.9.28

func (ops *GoRedisStandaloneOps) Publish(channel string, message interface{}) (int64, error)

Publish posts a message to the channel

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) Set

func (ops *GoRedisStandaloneOps) Set(key string, value string, expiration time.Duration) error

func (*GoRedisStandaloneOps) SetExpire

func (ops *GoRedisStandaloneOps) SetExpire(key string, expiration time.Duration) (bool, error)

func (*GoRedisStandaloneOps) SetIfAbsent added in v1.9.28

func (ops *GoRedisStandaloneOps) SetIfAbsent(key string, value interface{}) (bool, error)

SetIfAbsent sets the value if the key does not exist (alias for SetNX)

func (*GoRedisStandaloneOps) SetIfAbsentWithTTL added in v1.9.28

func (ops *GoRedisStandaloneOps) SetIfAbsentWithTTL(key string, value interface{}, duration time.Duration) (bool, error)

SetIfAbsentWithTTL sets the value with TTL if the key does not exist

func (*GoRedisStandaloneOps) SetNX

func (ops *GoRedisStandaloneOps) SetNX(key string, value interface{}) (bool, error)

func (*GoRedisStandaloneOps) SetNXTtl added in v1.9.28

func (ops *GoRedisStandaloneOps) SetNXTtl(key string, value interface{}, duration time.Duration) (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) Subscribe added in v1.9.28

func (ops *GoRedisStandaloneOps) Subscribe(channels ...string) (*Subscription, error)

Subscribe subscribes the client to the specified channels

func (*GoRedisStandaloneOps) TTL

func (ops *GoRedisStandaloneOps) TTL(key string) (time.Duration, error)

func (*GoRedisStandaloneOps) TxPipeline added in v1.9.28

func (ops *GoRedisStandaloneOps) TxPipeline() Pipeline

TxPipeline creates a transaction pipeline

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) Delete

func (h Hash) Delete(key string, hashKey string) error

Delete delete hashset for key and hash key

func (Hash) Exists

func (h Hash) Exists(key string, hashKey string) bool

Exists has key and hash key

func (Hash) Get

func (h Hash) Get(key string, hashKey string, value interface{}) error

Get get value(struct , int64, float64) for the key and hash key

func (Hash) GetEntries

func (h Hash) GetEntries(key string) (map[string]string, error)

GetEntries get all hash keys and values

func (Hash) GetHashKeys

func (h Hash) GetHashKeys(key string) ([]string, error)

GetHashKeys get hask keys for the key

func (Hash) GetString

func (h Hash) GetString(key string, hashKey string) (string, error)

GetString get string for key and hash key

func (Hash) Increment

func (h Hash) Increment(key string, hashKey string, delta int64) int64

Increment increment value by delta step to the key and hash key

func (Hash) MultiGet

func (h Hash) MultiGet(key string, hashKeys ...string) ([]interface{}, error)

MultiGet get all values for the keys

func (Hash) Put

func (h Hash) Put(key string, hashKey string, value interface{}) error

Put put value (struct , int64, float64) to the key and hash key

func (Hash) PutIfAbsent

func (h Hash) PutIfAbsent(key string, hashKey string, value interface{}) (bool, error)

Put put value (struct , int64, float64) to the key and hash key; cmd by SetNx .

func (Hash) Size

func (h Hash) Size(key string) int64

Size get len by key's all hash size

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
	//GetPubSubOps Returns the operations performed on publish/subscribe values.
	GetPubSubOps() PubSub
	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)
	Info() (string, error)
	ListKeys(page uint64, pattern string, pageSize int64) ([]string, int, error)
	// GetPipeline creates a  pipeline
	GetPipeline() Pipeline
	// GetTxPipeline creates a transaction pipeline
	GetTxPipeline() Pipeline
}

IClient redis client interface

func NewClient

func NewClient(options *Options) IClient

NewClient new redis client by Options

func NewClientFromOps added in v1.9.28

func NewClientFromOps(ops Ops) IClient

NewClientFromOps 使用已有的 Ops 创建客户端 这个方法允许使用外部创建的 Ops(如从连接池获取的)

func WrapClient added in v1.9.28

func WrapClient(client IClient) IClient

WrapClient 包装从连接池获取的 Redis 客户端 这个方法用于将数据源连接池中获取的客户端包装为统一的 IClient 接口

type ISerializer

type ISerializer interface {
	Serialization(value interface{}) ([]byte, error)
	Deserialization(byt []byte, ptr interface{}) (err error)
}

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) Append

func (kv KV) Append(key string, value string) int64

Append append string,to the string

func (KV) Get

func (kv KV) Get(key string, ptr interface{}) error

Get get serialization object for the key

func (KV) GetAndSet

func (kv KV) GetAndSet(key string, value string) (string, error)

GetAndSet get value for the key , and that if it's null, set value to the key.

func (KV) GetString

func (kv KV) GetString(key string) (string, error)

Get get string for the key

func (KV) Increment

func (kv KV) Increment(key string, delta int64) (int64, error)

Increment Increment delta step value(-x,x) for the key

func (KV) MultiGet

func (kv KV) MultiGet(keys ...string) ([]interface{}, error)

MultiGet is like Get but accepts multiple keys:

func (KV) MultiSet

func (kv KV) 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 (KV) Set

func (kv KV) Set(key string, value interface{}, duration time.Duration) error

Set set serialization object to the key

func (KV) SetIfAbsent

func (kv KV) SetIfAbsent(key string, value interface{}) (bool, error)

Set set serialization object to the key, redis cmd: setnx

func (KV) SetString

func (kv KV) SetString(key string, value string, duration time.Duration) error

Get string for the key

type List

type List struct {
	// contains filtered or unexported fields
}

the List elements type is string

func (List) AddElements

func (ls List) AddElements(key string, values ...interface{}) error

AddElements add serialization elements to key list

func (List) Clear

func (ls List) Clear(key string) (bool, error)

Clear clear the key List

func (List) GetElement

func (ls List) GetElement(key string, index int64, elem interface{}) error

GetElement get serialization element for key list

func (List) GetElements

func (ls List) GetElements(key string, startIndex int64, endIndex int64, elements interface{})

GetElements get serialization elements for key list

func (List) Index

func (ls List) Index(key string, index int64) (string, error)

Index get index elements from key List

func (List) LeftPop

func (ls List) LeftPop(key string) (string, error)

LeftPop left pop the element from key List

func (List) LeftPush

func (ls List) LeftPush(key string, value ...interface{}) (int64, error)

LeftPush left push element to key List

func (List) Range

func (ls List) Range(key string, start int64, end int64) ([]string, error)

Range get range elements(strings.) with key List by start and end index

func (List) Remove

func (ls List) Remove(key string, count int64, value interface{}) (int64, error)

Remove remove count number elements from key List, if

func (List) RightPop

func (ls List) RightPop(key string) (string, error)

RightPop right pop the element from key List ,that remove it.

func (List) RightPush

func (ls List) RightPush(key string, values ...interface{}) (int64, error)

RightPush right push element to key List

func (List) Set

func (ls List) Set(key string, index int64, value interface{}) error

Set set element to key List by index

func (List) Size

func (ls List) Size(key string) (int64, error)

Size the key List of size

func (List) Trim

func (ls List) Trim(key string, start int64, end int64) error

Trim trim range(start-end index) with key List ,and then remove the others.

type Lock

type Lock struct {
	// contains filtered or unexported fields
}

func NewLock added in v1.9.28

func NewLock(ops Ops) *Lock

func (*Lock) DisposeLock

func (lock *Lock) DisposeLock(key string) (error, bool)

DisposeLock releases the lock. Note: This method is deprecated, use Unlock instead.

Parameters:

  • key: lock key

Returns:

  • error: any error that occurred
  • bool: true if lock released, false otherwise

func (*Lock) Extend added in v1.9.28

func (lock *Lock) Extend(key string, leaseTime time.Duration) error

Extend extends the lock expiration time. Only the lock holder can extend the lock.

Example:

err := lock.Extend("mykey", 30*time.Second)

func (*Lock) ForceUnlock added in v1.9.28

func (lock *Lock) ForceUnlock(key string) error

ForceUnlock forcibly releases the lock regardless of holder. Use with caution!

Example:

err := lock.ForceUnlock("mykey")

func (*Lock) GetDLock

func (lock *Lock) GetDLock(key string, waitSecond int) (error, bool)

GetDLock acquires a lock with wait timeout. Note: This method is deprecated, use TryLockWithWait instead.

Parameters:

  • key: lock key
  • waitSecond: wait timeout in seconds

Returns:

  • error: any error that occurred
  • bool: true if lock acquired, false otherwise

func (*Lock) GetDLockWithTtl added in v1.9.28

func (lock *Lock) GetDLockWithTtl(key string, waitSecond int, duration time.Duration) (error, bool)

GetDLockWithTtl acquires a lock with TTL and wait timeout. Note: This method is deprecated, use TryLockWithWait instead.

Parameters:

  • key: lock key
  • waitSecond: wait timeout in seconds
  • duration: lock TTL

Returns:

  • error: any error that occurred
  • bool: true if lock acquired, false otherwise

func (*Lock) IsLocked added in v1.9.28

func (lock *Lock) IsLocked(key string) (bool, error)

IsLocked checks if the lock is currently held.

Example:

ok := lock.IsLocked("mykey")

func (*Lock) LockWithContext added in v1.9.28

func (lock *Lock) LockWithContext(ctx context.Context, key string, leaseTime time.Duration) (context.Context, error)

LockWithContext acquires a lock and stores it in context for automatic release. The lock will be automatically released when the context is cancelled.

Example: ctx, cancel := context.WithCancel(context.Background()) ctx, err := lock.LockWithContext(ctx, "mykey", 30*time.Second)

if err != nil {
    return err
}

defer cancel() // do work with lock

func (*Lock) SetIfAbsent added in v1.9.28

func (lock *Lock) SetIfAbsent(key string, value interface{}) (bool, error)

SetIfAbsent sets the value if the key does not exist (alias for SetNX)

func (*Lock) SetIfAbsentWithTTL added in v1.9.28

func (lock *Lock) SetIfAbsentWithTTL(key string, value interface{}, duration time.Duration) (bool, error)

SetIfAbsentWithTTL sets the value with TTL if the key does not exist

func (*Lock) TryLock added in v1.9.28

func (lock *Lock) TryLock(key string, leaseTime time.Duration) (error, bool)

TryLock attempts to acquire a lock with the specified lease time. Returns true if lock is acquired, false otherwise.

Parameters:

  • key: lock key
  • leaseTime: lock expiration time (if <= 0, uses default)

Example:

err, ok := lock.TryLock("mykey", 30*time.Second)

func (*Lock) TryLockWithWait added in v1.9.28

func (lock *Lock) TryLockWithWait(key string, waitTime time.Duration, leaseTime time.Duration) (error, bool)

TryLockWithWait attempts to acquire a lock with wait timeout. This is similar to Redisson's tryLock() method.

Parameters:

  • key: lock key
  • waitTime: maximum time to wait for lock
  • leaseTime: lock expiration time

Example:

err, ok := lock.TryLockWithWait("mykey", 10*time.Second, 30*time.Second)

func (*Lock) Unlock added in v1.9.28

func (lock *Lock) Unlock(key string) error

Unlock releases the lock. This is safe - only the lock holder can release the lock.

Example:

err := lock.Unlock("mykey")

type Message added in v1.9.28

type Message struct {
	Channel string
	Pattern string
	Payload string
}

Message represents a message received from Redis pub/sub

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)
	SetIfAbsent(key string, value interface{}) (bool, error)
	SetIfAbsentWithTTL(key string, value interface{}, duration time.Duration) (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
	Info() (string, error)
	ListKeys(page uint64, pattern string, pageSize int64) ([]string, int, error)
	Publish(channel string, message interface{}) (int64, error)
	Subscribe(channels ...string) (*Subscription, error)
	PSubscribe(patterns ...string) (*Subscription, error)
	SetNXTtl(key string, value interface{}, duration time.Duration) (bool, error)
	Eval(script string, keys []string, args ...interface{}) (interface{}, error)
	Pipeline() Pipeline
	TxPipeline() Pipeline
}

type Options

type Options struct {
	Addr     string
	Addrs    []string
	Password string
	DB       int
	// 连接池配置 (v9 优化)
	PoolSize        int           // 连接池大小,默认 10
	MinIdleConns    int           // 最小空闲连接数,默认 2
	MaxRetries      int           // 最大重试次数,默认 3
	MinRetryBackoff time.Duration // 最小重试间隔,默认 8ms
	MaxRetryBackoff time.Duration // 最大重试间隔,默认 512ms
	DialTimeout     time.Duration // 连接超时,默认 5s
	ReadTimeout     time.Duration // 读取超时,默认 3s
	WriteTimeout    time.Duration // 写入超时,默认 3s
	PoolTimeout     time.Duration // 连接池超时,默认 4s
	ConnMaxIdleTime time.Duration // 连接间隔时间,默认 1m
}

type Pipeline added in v1.9.28

type Pipeline interface {
	// Set 批量设置值
	Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
	// Get 批量获取值
	Get(key string) *redis.StringCmd

	// SetNX 批量设置值(仅当键不存在)
	SetNX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd

	// Del 批量删除键
	Del(keys ...string) *redis.IntCmd

	// Incr 批量递增
	Incr(key string) *redis.IntCmd

	// IncrBy 批量递增指定步长
	IncrBy(key string, value int64) *redis.IntCmd

	// HSet 批量设置哈希字段
	HSet(key string, field string, value interface{}) *redis.IntCmd

	// HGet 批量获取哈希字段
	HGet(key string, field string) *redis.StringCmd

	// ZAdd 批量添加有序集合成员
	ZAdd(key string, members ...redis.Z) *redis.IntCmd

	// SAdd 批量添加无序集合成员
	SAdd(key string, members ...interface{}) *redis.IntCmd

	// LPush 批量列表左推入
	LPush(key string, values ...interface{}) *redis.IntCmd

	// RPush 批量列表右推入
	RPush(key string, values ...interface{}) *redis.IntCmd

	// MGet 批量获取多个键
	MGet(keys ...string) *redis.SliceCmd

	// MSet 批量设置多个键
	MSet(pairs ...interface{}) *redis.StatusCmd

	// Exec 执行所有命令
	Exec(ctx context.Context) ([]redis.Cmder, error)

	// Discard 丢弃 Pipeline
	Discard()
}

Pipeline 封装 Redis Pipeline 操作,支持批量执行命令 v9 的 Pipeline 性能相比 v8 提升了约 38%

func NewPipeline added in v1.9.28

func NewPipeline(client redis.Pipeliner, serializer ISerializer) Pipeline

NewPipeline 创建新的 Pipeline

type PubSub added in v1.9.28

type PubSub struct {
	// contains filtered or unexported fields
}

PubSub provides pub/sub operations following the pattern of KV, List, etc.

func (PubSub) PSubscribe added in v1.9.28

func (ps PubSub) PSubscribe(patterns ...string) (*Subscription, error)

PSubscribe subscribes to channels matching the given patterns

func (PubSub) PSubscribeWithCallback added in v1.9.28

func (ps PubSub) PSubscribeWithCallback(callback func(*Message), patterns ...string) (*Subscription, error)

PSubscribeWithCallback subscribes to patterns and invokes callback for each message

func (PubSub) Publish added in v1.9.28

func (ps PubSub) Publish(channel string, message interface{}) (int64, error)

Publish posts a message to the channel

func (PubSub) ReceiveMessage added in v1.9.28

func (ps PubSub) ReceiveMessage(channel string) (*Message, error)

ReceiveMessage receives a single message from a channel

func (PubSub) ReceiveMessageTimeout added in v1.9.28

func (ps PubSub) ReceiveMessageTimeout(channel string, timeout time.Duration) (*Message, error)

ReceiveMessageTimeout receives a single message from a channel with timeout

func (PubSub) ReceiveMessages added in v1.9.28

func (ps PubSub) ReceiveMessages(channel string, messageChan chan<- *Message) (*Subscription, error)

ReceiveMessages continuously receives messages from a channel

func (PubSub) ReceiveMessagesWithPattern added in v1.9.28

func (ps PubSub) ReceiveMessagesWithPattern(pattern string, messageChan chan<- *Message) (*Subscription, error)

ReceiveMessagesWithPattern continuously receives messages matching a pattern

func (PubSub) Subscribe added in v1.9.28

func (ps PubSub) Subscribe(channels ...string) (*Subscription, error)

Subscribe subscribes to the specified channels

func (PubSub) SubscribeWithCallback added in v1.9.28

func (ps PubSub) SubscribeWithCallback(callback func(*Message), channels ...string) (*Subscription, error)

SubscribeWithCallback subscribes to channels and invokes callback for each message

type Set

type Set struct {
	// contains filtered or unexported fields
}

func (Set) Add

func (set Set) Add(key string, members ...interface{}) (int64, error)

func (Set) Difference

func (set Set) Difference(keys ...string) ([]string, error)

func (Set) Intersect

func (set Set) Intersect(keys ...string) ([]string, error)

func (Set) IntersectAndStore

func (set Set) IntersectAndStore(destination string, keys ...string) (int64, error)

func (Set) IsMember

func (set Set) IsMember(key string, member interface{}) (bool, error)

func (Set) Members

func (set Set) Members(key string) ([]string, error)

func (Set) Move

func (set Set) Move(source string, destination string, member interface{}) (bool, error)

func (Set) Pop

func (set Set) Pop(key string) (string, error)

func (Set) RandMembers

func (set Set) RandMembers(key string, count int64) ([]string, error)

func (Set) Remove

func (set Set) Remove(key string, members ...interface{}) (int64, error)

func (Set) Size

func (set Set) Size(key string) (int64, error)

func (Set) Union

func (set Set) Union(keys ...string) ([]string, error)

func (Set) UnionAndStore

func (set Set) UnionAndStore(destination string, keys ...string) (int64, error)

type Subscription added in v1.9.28

type Subscription struct {
	// contains filtered or unexported fields
}

Subscription represents a Redis pub/sub subscription

func (*Subscription) Channel added in v1.9.28

func (s *Subscription) Channel() <-chan *Message

Channel returns a go channel for receiving messages

func (*Subscription) Close added in v1.9.28

func (s *Subscription) Close() error

Close closes the subscription

func (*Subscription) Ping added in v1.9.28

func (s *Subscription) Ping() error

Ping sends a PING to the server

func (*Subscription) ReceiveMessage added in v1.9.28

func (s *Subscription) ReceiveMessage() (*Message, error)

ReceiveMessage receives a message from the subscription

type ZMember

type ZMember struct {
	Score  float64
	Member string
}

type ZSet

type ZSet struct {
	// contains filtered or unexported fields
}

func (*ZSet) ZAdd

func (zSet *ZSet) ZAdd(key string, member ZMember) int64

func (*ZSet) ZCard

func (zSet *ZSet) ZCard(key string) int64

func (*ZSet) ZCount

func (zSet *ZSet) ZCount(key string, min, max float64) int64

func (*ZSet) ZIncrby

func (zSet *ZSet) ZIncrby(key string, incr float64, member string) float64

func (*ZSet) ZInterStore

func (zSet *ZSet) ZInterStore(destination string, store []ZStore, arg ZStoreEnum) int64

func (*ZSet) ZLexCount

func (zSet *ZSet) ZLexCount(key, min, max string) int64

func (*ZSet) ZRange

func (zSet *ZSet) ZRange(key string, start, stop int64) []string

func (*ZSet) ZRangeByLex

func (zSet *ZSet) ZRangeByLex(key, min, max string, offset int64, count int64) []string

func (*ZSet) ZRangeByScore

func (zSet *ZSet) ZRangeByScore(key, min, max string, offset int64, count int64) []string

func (*ZSet) ZRank

func (zSet *ZSet) ZRank(key, member string) int64

func (*ZSet) ZRem

func (zSet *ZSet) ZRem(key string, member ...string) int64

func (*ZSet) ZRemRangeByLex

func (zSet *ZSet) ZRemRangeByLex(key, min, max string) int64

func (*ZSet) ZRemRangeByRank

func (zSet *ZSet) ZRemRangeByRank(key string, start, stop int64) int64

func (*ZSet) ZRevRange

func (zSet *ZSet) ZRevRange(key string, start, stop int64) []string

func (*ZSet) ZRevRangeWithScores

func (zSet *ZSet) ZRevRangeWithScores(key string, start, stop int64) ([]ZMember, error)

func (*ZSet) ZRevRank

func (zSet *ZSet) ZRevRank(key, member string) int64

func (*ZSet) ZScore

func (zSet *ZSet) ZScore(key, member string) float64

type ZStore

type ZStore struct {
	Key    string
	Weight float64
}

type ZStoreEnum

type ZStoreEnum string
const (
	MAX ZStoreEnum = "MAX"
	MIN ZStoreEnum = "MIN"
	SUM ZStoreEnum = "SUM"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL