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) Del(key string) error
- func (r *RedisClient) Dels(keys []string) 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) 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) ZAdd(key string, score int64, member interface{}) error
- func (r *RedisClient) ZCard(key string) (int, 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) 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) Del ¶
func (r *RedisClient) Del(key string) error
///////////////////////////////////////////////////////////////////// general purpose ///////////////////////////////////////////////////////////////////// Del 删除某个key
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)
///////////////////////////////////////////////////////////////////////// set ///////////////////////////////////////////////////////////////////////// 获取某个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)
//////////////////////////////////////////////////////////////////// hash map operations //////////////////////////////////////////////////////////////////// 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)
/////////////////////////////////////////////////////////// list /////////////////////////////////////////////////////////// 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)
///////////////////////////////////////////////////////////////////////////// set ///////////////////////////////////////////////////////////////////////////// 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) ZAdd ¶
func (r *RedisClient) ZAdd(key string, score int64, member interface{}) error
ZAdd
func (*RedisClient) ZInterstore ¶
func (r *RedisClient) ZInterstore(destKey string, keys ...interface{}) (int64, error)
ZInterstore
func (*RedisClient) ZRangeByScore ¶
func (r *RedisClient) ZRangeByScore(key string, min, max interface{}) ([]string, error)
ZRangeByScore
func (*RedisClient) ZRemRangeByScore ¶
func (r *RedisClient) ZRemRangeByScore(key string, min, max interface{}) error
///////////////////////////////////////////////////////////////////////////////////// sorted set ///////////////////////////////////////////////////////////////////////////////////// ZRemRangeByScore
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