Documentation ¶
Index ¶
- Constants
- func PutClient(cli *Client)
- func RegisterParamBuilder(builder ParamBuilder)
- type Client
- func (c *Client) Del(keys ...string) (err error)
- func (c *Client) Exists(key string) (ok bool, err error)
- func (c *Client) Expire(key string, ttl int) (err error)
- func (c *Client) ExpireAt(key string, expire int) (err error)
- func (c *Client) Get(key string) (val []byte, ok bool, err error)
- func (c *Client) GetInt64(key string) (val int64, ok bool, err error)
- func (c *Client) GetMD5(key string) (val []byte, md string, ok bool, err error)
- func (c *Client) HDel(key string, fields ...any) error
- func (c *Client) HExists(key, field string) (ok bool, err error)
- func (c *Client) HGet(key, field string) (val []byte, err error)
- func (c *Client) HGetAll(key string) (val map[string]string, err error)
- func (c *Client) HGetInt64(key, field string) (val int64, err error)
- func (c *Client) HIncrBy(key, field string, delta int) (val int, err error)
- func (c *Client) HKeys(key string) (keys []string, err error)
- func (c *Client) HLen(key string) (nLen int, err error)
- func (c *Client) HMGet(key string, fields ...any) (ret [][]byte, err error)
- func (c *Client) HMGetInt64(key string, fields ...any) (ret []int64, err error)
- func (c *Client) HMSet(key string, val ...any) (err error)
- func (c *Client) HMSetMap(key string, val map[string]any) (err error)
- func (c *Client) HMSetMapInt64(key string, val map[string]int64) (err error)
- func (c *Client) HScan(key string, cursor, count int, pattern string) (newCursor int, pairs map[string]string, err error)
- func (c *Client) HSet(key, field string, val any) (err error)
- func (c *Client) HSetNX(key, field string, val any) (ok bool, err error)
- func (c *Client) IncrBy(key string, delta int) (ret int, err error)
- func (c *Client) LLen(key string) (n int, err error)
- func (c *Client) LPop(key string) (val []byte, err error)
- func (c *Client) LPush(key string, val ...any) error
- func (c *Client) LRange(key string, start, stop int) ([]string, error)
- func (c *Client) LTrim(key string, start int, end int) (err error)
- func (c *Client) MGet(keys ...string) (ret [][]byte, err error)
- func (c *Client) MSet(kvs ...any) (err error)
- func (c *Client) MultiHGet(keys []string, field string) (vals [][]byte, err error)
- func (c *Client) Put()
- func (c *Client) RPush(key string, val ...any) error
- func (c *Client) SAdd(key string, val ...any) error
- func (c *Client) SCard(key string) (int, error)
- func (c *Client) SIsMember(key string, member any) (ok bool, err error)
- func (c *Client) SMembers(key string) ([]string, error)
- func (c *Client) SPop(key string) (val string, err error)
- func (c *Client) SRandMembers(key string, count ...int) ([]string, error)
- func (c *Client) SRem(key string, val ...any) error
- func (c *Client) SScan(key string, cursor, count int, pattern string) (nextCursor int, vals []string, err error)
- func (c *Client) Scan(cursor, count int, patterns ...string) (newCursor int, keys []string, err error)
- func (c *Client) Set(key string, val any) (err error)
- func (c *Client) SetEX(key string, ttl int, val any) (err error)
- func (c *Client) SetEXNX(key string, ttl int, val any) (ok bool, err error)
- func (c *Client) SetMD5(key string, val any, md string) (err error)
- func (c *Client) SetNX(key string, val any) (ok bool, err error)
- func (c *Client) SetPXNX(key string, ttl int, val any) (ok bool, err error)
- func (c *Client) TTL(key string) (int, error)
- func (c *Client) Time() ([]int, error)
- func (c *Client) Type(key string) (t KeyType, ok bool, err error)
- func (c *Client) ZAdd(key string, val ...any) error
- func (c *Client) ZCard(key string) (int, error)
- func (c *Client) ZIncrBy(key, member string, score int) (int, error)
- func (c *Client) ZRange(key string, start, end int) ([]string, error)
- func (c *Client) ZRangeByScore(key string, start, end int) ([]string, error)
- func (c *Client) ZRangeOfSlices(key string, start, end int) ([][]byte, error)
- func (c *Client) ZRangeWithScores(key string, start, end int) ([]string, error)
- func (c *Client) ZRank(key, member string) (int, error)
- func (c *Client) ZRem(key string, members ...any) error
- func (c *Client) ZRemRangeByRank(key string, start, stop int64) (n int64, err error)
- func (c *Client) ZRevRange(key string, start, end int) ([]string, error)
- func (c *Client) ZRevRangeWithScores(key string, start, end int) ([]string, error)
- func (c *Client) ZRevRank(key, member string) (int, error)
- func (c *Client) ZScore(key, member string) (int, error)
- type KeyType
- type ParamBuilder
- type Pool
- type PoolParam
- type RoutePolicy
Constants ¶
View Source
const ( // RoutePolicyRoundRobin 轮转 RoutePolicyRoundRobin = iota // RoutePolicyRandom 随机 RoutePolicyRandom )
Variables ¶
This section is empty.
Functions ¶
func RegisterParamBuilder ¶
func RegisterParamBuilder(builder ParamBuilder)
Types ¶
type Client ¶
Client Wrapper the Redis conn
func (*Client) HMGetInt64 ¶
func (*Client) HMSetMapInt64 ¶
func (*Client) HScan ¶
func (c *Client) HScan(key string, cursor, count int, pattern string) (newCursor int, pairs map[string]string, err error)
HScan hash scan
func (*Client) SRandMembers ¶
SRandMembers 随机返回集合中的成员
func (*Client) Scan ¶
func (c *Client) Scan(cursor, count int, patterns ...string) (newCursor int, keys []string, err error)
Scan scan
func (*Client) SetMD5 ¶
SetMD5 set the value to the key, success if the md equals to the original md5sum of the value
func (*Client) ZRangeByScore ¶
func (*Client) ZRangeOfSlices ¶
ZRangeOfSlices 按分数值递增返回有序集合成指定区间[start, end]内的成员(不包括score)
func (*Client) ZRangeWithScores ¶
ZRangeWithScores 按分数值递减返回有序集合成指定区间[start, end]内的成员 返回的[]string中,偶数下标的元素为member,该member对应的score值存储在后一个元素里面
func (*Client) ZRemRangeByRank ¶
func (*Client) ZRevRangeWithScores ¶
ZRevRangeWithScores 通过索引区间返回有序集合成指定区间[start, end]内的成员 返回的[]string中,偶数下标的元素为member,该member对应的score值存储在后一个元素里面
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool implements the connection pool of redis
func NewPoolWithParam ¶
NewPoolWithParam 使用param参数创建连接池
func (*Pool) SetAddrList ¶
SetAddrList 支持运行时动态设置redis服务器地址
type PoolParam ¶
type PoolParam struct { Name string //连接池名字 Addr string //redis地址 ip:port @deprecated Policy RoutePolicy //负载均衡策略 Pass string //密码,没有则为空 MaxIdle int //做多允许多少空闲连接 MaxActive int //最多允许多少并发连接 IdleTimeoutSecond int //单个链接空闲多久被销毁,单位秒 NetworkTimeoutMsec int //网络超时(connect,send,recv),单位毫秒 HealthCheckIntervalSec int //定时检查池子里面的节点是是否健康 // contains filtered or unexported fields }
PoolParam 连接池参数
Click to show internal directories.
Click to hide internal directories.