Documentation ¶
Index ¶
- type Config
- type Mode
- type Redis
- func (r *Redis) Close() error
- func (r *Redis) ClusterClient() *redis.ClusterClient
- func (r *Redis) Decr(key string) bool
- func (r *Redis) Del(key ...string) int64
- func (r *Redis) DelWithErr(key string) (int64, error)
- func (r *Redis) Exists(key string) bool
- func (r *Redis) ExistsWithErr(key string) (bool, error)
- func (r *Redis) Expire(key string, expiration time.Duration) (bool, error)
- func (r *Redis) GeoAdd(key string, location *redis.GeoLocation) (int64, error)
- func (r *Redis) GeoRadius(key string, longitude, latitude float64, query *redis.GeoRadiusQuery) ([]redis.GeoLocation, error)
- func (r *Redis) Get(key string) string
- func (r *Redis) GetBytes(key string) []byte
- func (r *Redis) HDel(key string, field ...string) bool
- func (r *Redis) HGet(key string, fields string) (string, error)
- func (r *Redis) HGetAll(key string) map[string]string
- func (r *Redis) HIncrBy(key string, field string, incr int) int64
- func (r *Redis) HIncrByWithErr(key string, field string, incr int) (int64, error)
- func (r *Redis) HKeys(key string) []string
- func (r *Redis) HLen(key string) int64
- func (r *Redis) HMGet(key string, fileds []string) []string
- func (r *Redis) HMGetMap(key string, fields []string) map[string]string
- func (r *Redis) HMSet(key string, hash map[string]interface{}, expire time.Duration) bool
- func (r *Redis) HSet(key string, field string, value interface{}) bool
- func (r *Redis) Incr(key string) bool
- func (r *Redis) IncrBy(key string, increment int64) (int64, error)
- func (r *Redis) IncrWithErr(key string) (int64, error)
- func (r *Redis) Keys(pattern string) []string
- func (r *Redis) LIndex(key string, idx int64) (string, error)
- func (r *Redis) LLen(key string) int64
- func (r *Redis) LLenWithErr(key string) (int64, error)
- func (r *Redis) LPush(key string, values ...interface{}) (int64, error)
- func (r *Redis) LRange(key string, start, stop int64) ([]string, error)
- func (r *Redis) LRem(key string, count int64, value interface{}) int64
- func (r *Redis) LTrim(key string, start, stop int64) (string, error)
- func (r *Redis) MGet(keys ...string) ([]string, error)
- func (r *Redis) MGets(keys []string) ([]interface{}, error)
- func (r *Redis) RPop(key string) (string, error)
- func (r *Redis) RPush(key string, values ...interface{}) (int64, error)
- func (r *Redis) SAdd(key string, member ...interface{}) (int64, error)
- func (r *Redis) SIsMember(key string, member interface{}) (bool, error)
- func (r *Redis) SMembers(key string) ([]string, error)
- func (r *Redis) Scan(cursor uint64, match string, count int64) ([]string, error)
- func (r *Redis) Set(key string, value interface{}, expire time.Duration) bool
- func (r *Redis) SetNx(key string, value interface{}, expiration time.Duration) bool
- func (r *Redis) SetNxWithErr(key string, value interface{}, expiration time.Duration) (bool, error)
- func (r *Redis) SetWithErr(key string, value interface{}, expire time.Duration) error
- func (r *Redis) SimpClient() *redis.Client
- func (r *Redis) TTL(key string) (int64, error)
- func (r *Redis) Type(key string) (string, error)
- func (r *Redis) ZAdd(key string, members ...redis.Z) (int64, error)
- func (r *Redis) ZCard(key string) (int64, error)
- func (r *Redis) ZCount(key string, min, max string) (int64, error)
- func (r *Redis) ZRange(key string, start, stop int64) ([]string, error)
- func (r *Redis) ZRem(key string, members ...interface{}) (int64, error)
- func (r *Redis) ZRemRangeByRank(key string, start, stop int64) (int64, error)
- func (r *Redis) ZRevRange(key string, start, stop int64) ([]string, error)
- func (r *Redis) ZRevRangeByScore(key string, opt redis.ZRangeBy) ([]string, error)
- func (r *Redis) ZRevRangeByScoreWithScores(key string, opt redis.ZRangeBy) ([]redis.Z, error)
- func (r *Redis) ZRevRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
- func (r *Redis) ZRevRank(key string, member string) (int64, error)
- func (r *Redis) ZScore(key string, member string) (float64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Addrs []string `json:"addrs"` // 连接地址 Mode Mode `json:"mode"` // 模式(cluster,simple) Password string `json:"password"` // 密码 DB int `json:"db"` // DB,默认为0, 一般应用不推荐使用DB分片 PoolSize int `json:"pool_size"` // 集群内每个节点的最大连接池限制 默认每个CPU10个连接 MaxRetries int `json:"maxRetries"` //网络相关的错误最大重试次数 默认5次 MinIdleConns int `json:"min_idle_conns"` // 最小空闲连接数,默认100 DialTimeout time.Duration `json:"dial_timeout"` // 连接超时 ReadTimeout time.Duration `json:"read_timeout"` //读取超时 默认3s WriteTimeout time.Duration `json:"write_timeout"` // 写入超时 默认3s IdleTimeout time.Duration `json:"idle_timeout"` // 连接最大空闲时间,默认60s, 超过该时间,连接会被主动关闭 Debug bool `json:"debug"` // 是否开启debug模式 ReadOnly bool `json:"readOnly"` // 集群模式中在从属节点上启用读模式 // contains filtered or unexported fields }
func DefaultConfig ¶
func DefaultConfig() *Config
type Redis ¶
type Redis struct { Config *Config // contains filtered or unexported fields }
func (*Redis) ClusterClient ¶
func (r *Redis) ClusterClient() *redis.ClusterClient
ClusterClient 获取redis集群客户端
func (*Redis) ExistsWithErr ¶
ExistsWithErr ...
func (*Redis) GeoRadius ¶
func (r *Redis) GeoRadius(key string, longitude, latitude float64, query *redis.GeoRadiusQuery) ([]redis.GeoLocation, error)
GeoRadius 根据经纬度查询列表
func (*Redis) HIncrByWithErr ¶
HIncrByWithErr 哈希field自增并且返回错误
func (*Redis) SetNxWithErr ¶
SetNxWithErr 设置redis的string 如果键已存在
func (*Redis) SetWithErr ¶
SetWithErr ...
func (*Redis) ZRemRangeByRank ¶
ZRemRangeByRank 移除有序集合中给定的排名区间的所有成员
func (*Redis) ZRevRangeByScore ¶
ZRevRangeByScore ...
func (*Redis) ZRevRangeByScoreWithScores ¶
ZRevRangeByScoreWithScores ...
func (*Redis) ZRevRangeWithScores ¶
ZRevRangeWithScores ...
Click to show internal directories.
Click to hide internal directories.