Documentation ¶
Overview ¶
@Title log capability of zerolog @Description zerolog implementation of log capability @Author Ryan Fan 2021-06-09 @Update Ryan Fan 2021-06-09
Index ¶
- func NewRedisClient(conf *RedisConf) types.CacheClient
- type ConfigRedis
- type RedisClient
- func (r *RedisClient) BfAdd(key string, item string) (exists bool, err error)
- func (r *RedisClient) BfAddMulti(key string, items []interface{}) ([]int64, error)
- func (r *RedisClient) BfExists(key string, item string) (exists bool, err error)
- func (r *RedisClient) BfExistsMulti(key string, items []interface{}) ([]int64, error)
- func (r *RedisClient) BfReserve(key string, errorRate float64, capacity uint64) (err error)
- func (r *RedisClient) DecrBy(key string, number int) error
- func (r *RedisClient) Del(key string) error
- func (r *RedisClient) Dels(keys []string) error
- func (r *RedisClient) Eval(scriptContent string, keys []interface{}, args []interface{}) (interface{}, error)
- func (r *RedisClient) Exists(key string) (bool, error)
- func (r *RedisClient) Expire(key string, expire int) error
- func (r *RedisClient) Get(key string) ([]byte, error)
- func (r *RedisClient) GetFloat64(key string) (float64, error)
- func (r *RedisClient) GetInt(key string) (int, error)
- func (r *RedisClient) GetInt64(key string) (int64, error)
- func (r *RedisClient) GetString(key string) (string, error)
- func (r *RedisClient) HDel(key string, field interface{}) (int, error)
- func (r *RedisClient) HDels(key string, fields []interface{}) (int, error)
- func (r *RedisClient) HGet(key string, field string) ([]byte, error)
- func (r *RedisClient) HGetAll(key string) (map[string]string, error)
- func (r *RedisClient) HGetFloat64(key string, field string) (float64, error)
- func (r *RedisClient) HGetInt(key string, field string) (int, error)
- func (r *RedisClient) HGetInt64(key string, field string) (int64, error)
- func (r *RedisClient) HGetString(key string, field string) (string, error)
- func (r *RedisClient) HLen(key string) (int, error)
- func (r *RedisClient) HMGet(key string, fields []string) ([][]byte, error)
- func (r *RedisClient) HMSet(key string, fieldvalues map[string]interface{}) error
- func (r *RedisClient) HSet(key string, field interface{}, value interface{}) (int, error)
- func (r *RedisClient) Incr(key string) error
- func (r *RedisClient) IncrBy(key string, number int) error
- func (r *RedisClient) Ping() error
- func (r *RedisClient) Pipeline(commands []*types.CacheCommand) (reply interface{}, err error)
- func (r *RedisClient) RPop(key string) ([]byte, error)
- func (r *RedisClient) SAdd(key string, members interface{}) error
- func (r *RedisClient) SDiff(keys []string) ([]string, error)
- func (r *RedisClient) SInter(keys []string) ([]string, error)
- func (r *RedisClient) SIsMember(key string, member interface{}) (bool, error)
- func (r *RedisClient) SMembers(key string) ([]string, error)
- func (r *RedisClient) SRem(key string, members interface{}) error
- func (r *RedisClient) SUnion(keys []string) ([]string, error)
- func (r *RedisClient) Set(key string, value interface{}) error
- func (r *RedisClient) SetEx(key string, value interface{}, expire int) error
- func (r *RedisClient) Shutdown()
- func (r *RedisClient) Ttl(key string) (int64, error)
- func (r *RedisClient) ZAdd(key string, score int64, member interface{}) error
- func (r *RedisClient) ZCard(key string) (int, error)
- func (r *RedisClient) ZIncrBy(key string, increment int64, member interface{}) error
- func (r *RedisClient) ZInterstore(destKey string, keys ...interface{}) (int64, error)
- func (r *RedisClient) ZRange(key string, min, max int64) (map[string]string, error)
- func (r *RedisClient) ZRangeByScore(key string, min, max interface{}) ([]string, error)
- func (r *RedisClient) ZRem(destKey string, members ...interface{}) (int64, error)
- func (r *RedisClient) ZRemRangeByScore(key string, min, max interface{}) error
- func (r *RedisClient) ZScore(key string, member interface{}) (int64, error)
- type RedisConf
- type RedisProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRedisClient ¶
func NewRedisClient(conf *RedisConf) types.CacheClient
Types ¶
type ConfigRedis ¶
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
func (*RedisClient) BfAdd ¶
func (r *RedisClient) BfAdd(key string, item string) (exists bool, err error)
BfAdd - Add (or create and add) a new value to the filter args: key - the name of the filter item - the item to add
func (*RedisClient) BfAddMulti ¶
func (r *RedisClient) BfAddMulti(key string, items []interface{}) ([]int64, error)
BfAddMulti - Adds one or more items to the Bloom Filter, creating the filter if it does not yet exist. args: key - the name of the filter item - One or more items to add
func (*RedisClient) BfExists ¶
func (r *RedisClient) BfExists(key string, item string) (exists bool, err error)
BfExists - Determines whether an item may exist in the Bloom Filter or not. args: key - the name of the filter item - the item to check for
func (*RedisClient) BfExistsMulti ¶
func (r *RedisClient) BfExistsMulti(key string, items []interface{}) ([]int64, error)
BfExistsMulti - Determines if one or more items may exist in the filter or not. args: key - the name of the filter item - one or more items to check
func (*RedisClient) BfReserve ¶
func (r *RedisClient) BfReserve(key string, errorRate float64, capacity uint64) (err error)
BfReserve - Creates an empty Bloom Filter with a given desired error ratio and initial capacity. args: key - the name of the filter error_rate - the desired probability for false positives capacity - the number of entries you intend to add to the filter
func (*RedisClient) Eval ¶
func (r *RedisClient) Eval(scriptContent string, keys []interface{}, args []interface{}) (interface{}, error)
func (*RedisClient) Exists ¶
func (r *RedisClient) Exists(key string) (bool, error)
Exists 检查某个key是否存在
func (*RedisClient) Expire ¶
func (r *RedisClient) Expire(key string, expire int) error
Expire 使某个key过期
func (*RedisClient) Get ¶
func (r *RedisClient) Get(key string) ([]byte, error)
Get 获取某个key的值,返回为[]byte
func (*RedisClient) GetFloat64 ¶
func (r *RedisClient) GetFloat64(key string) (float64, error)
func (*RedisClient) HDel ¶
func (r *RedisClient) HDel(key string, field interface{}) (int, error)
HDel 删除某个field
func (*RedisClient) HDels ¶
func (r *RedisClient) HDels(key string, fields []interface{}) (int, error)
HDels 删除多个field
func (*RedisClient) HGet ¶
func (r *RedisClient) HGet(key string, field string) ([]byte, error)
HGet 获取某个field的值
func (*RedisClient) HGetAll ¶
func (r *RedisClient) HGetAll(key string) (map[string]string, error)
HGetAll 获取所有fields的值
func (*RedisClient) HGetFloat64 ¶
func (r *RedisClient) HGetFloat64(key string, field string) (float64, error)
HGetFloat64 获取某个field的float64值
func (*RedisClient) HGetInt ¶
func (r *RedisClient) HGetInt(key string, field string) (int, error)
HGetInt 获取某个field的int值
func (*RedisClient) HGetInt64 ¶
func (r *RedisClient) HGetInt64(key string, field string) (int64, error)
HGetInt64 获取某个field的int64值
func (*RedisClient) HGetString ¶
func (r *RedisClient) HGetString(key string, field string) (string, error)
HGetString 获取某个field的float64值
func (*RedisClient) HMGet ¶
func (r *RedisClient) HMGet(key string, fields []string) ([][]byte, error)
HMGet 一次获取多个field的值,返回为二维[]byte
func (*RedisClient) HMSet ¶
func (r *RedisClient) HMSet(key string, fieldvalues map[string]interface{}) error
HMSet 一次设置多个field的值
func (*RedisClient) HSet ¶
func (r *RedisClient) HSet(key string, field interface{}, value interface{}) (int, error)
HSet 设置某个field的值
func (*RedisClient) Pipeline ¶
func (r *RedisClient) Pipeline(commands []*types.CacheCommand) (reply interface{}, err error)
Pipeline 批量提交命令
func (*RedisClient) RPop ¶
func (r *RedisClient) RPop(key string) ([]byte, error)
RPop 移除列表的最后一个元素,返回值为移除的元素
func (*RedisClient) SAdd ¶
func (r *RedisClient) SAdd(key string, members interface{}) error
SAdd 集合中添加一个成员
func (*RedisClient) SDiff ¶
func (r *RedisClient) SDiff(keys []string) ([]string, error)
SDiff 比较不同集合中的不同元素
func (*RedisClient) SInter ¶
func (r *RedisClient) SInter(keys []string) ([]string, error)
SInter 取不同keys中集合的交集
func (*RedisClient) SIsMember ¶
func (r *RedisClient) SIsMember(key string, member interface{}) (bool, error)
SIsMember 检查中成员是否出现在key中
func (*RedisClient) SMembers ¶
func (r *RedisClient) SMembers(key string) ([]string, error)
SMembers 取集合中的成员
func (*RedisClient) SRem ¶
func (r *RedisClient) SRem(key string, members interface{}) error
SRem 集合中删除一个成员
func (*RedisClient) SUnion ¶
func (r *RedisClient) SUnion(keys []string) ([]string, error)
SUnion 取不同keys中集合的并集
func (*RedisClient) Set ¶
func (r *RedisClient) Set(key string, value interface{}) error
Set 设置某个key为value
func (*RedisClient) SetEx ¶
func (r *RedisClient) SetEx(key string, value interface{}, expire int) error
SetEx 设置某个key为value,并设置过期时间(单位为秒)
func (*RedisClient) Ttl ¶ added in v1.0.4
func (r *RedisClient) Ttl(key string) (int64, error)
Ttl 获取某个key的过期时间
func (*RedisClient) ZAdd ¶
func (r *RedisClient) ZAdd(key string, score int64, member interface{}) error
ZAdd add a member
func (*RedisClient) ZCard ¶
func (r *RedisClient) ZCard(key string) (int, error)
ZCard get members total
func (*RedisClient) ZIncrBy ¶ added in v1.0.4
func (r *RedisClient) ZIncrBy(key string, increment int64, member interface{}) error
ZIncrBy add increment to member's score
func (*RedisClient) ZInterstore ¶
func (r *RedisClient) ZInterstore(destKey string, keys ...interface{}) (int64, error)
ZInterstore get intersect of set
func (*RedisClient) ZRangeByScore ¶
func (r *RedisClient) ZRangeByScore(key string, min, max interface{}) ([]string, error)
ZRangeByScore get members by score
func (*RedisClient) ZRem ¶ added in v1.0.5
func (r *RedisClient) ZRem(destKey string, members ...interface{}) (int64, error)
ZRem delete members
func (*RedisClient) ZRemRangeByScore ¶
func (r *RedisClient) ZRemRangeByScore(key string, min, max interface{}) error
ZRemRangeByScore delete members by score
type RedisProvider ¶
type RedisProvider struct { cache.BaseCacheProvider Log types.LogProvider }
func (*RedisProvider) Init ¶
func (rp *RedisProvider) Init(rootConfiger types.Configer, logger types.LogProvider, args ...interface{}) error
@desc implements types.Provider interface, used to initialize the capability @author Ryan Fan (2021-06-09) @param baseconf.Configer root config interface to extract config info @return error