Documentation
¶
Index ¶
- func GetRedisClient(client *Client) (baseClient *redis.Client)
- func Start(cfg Config) (key string, err error)
- type Client
- func (client *Client) Del(ctx context.Context, key string) bool
- func (client *Client) Eval(ctx context.Context, script string, keys []string, args []interface{}) (res interface{}, err error)
- func (client *Client) Expire(ctx context.Context, key string, t time.Duration) (bool, error)
- func (client *Client) Get(ctx context.Context, key string) (string, error)
- func (client *Client) GetClient() (redis.Cmdable, error)
- func (client *Client) HDel(ctx context.Context, key string, field string) (res int64, err error)
- func (client *Client) HGet(ctx context.Context, key string, field string) (res string, err error)
- func (client *Client) HGetAll(ctx context.Context, key string) (res map[string]string, err error)
- func (client *Client) HIncrby(ctx context.Context, key, field string, value int64) (res int64, err error)
- func (client *Client) HKeys(ctx context.Context, key string) (res []string, err error)
- func (client *Client) HMGet(ctx context.Context, key string, field []string) (res []interface{}, err error)
- func (client *Client) HMSet(ctx context.Context, key string, fields map[string]interface{}) (res bool, err error)
- func (client *Client) HSet(ctx context.Context, table, field string, value interface{}) (int64, error)
- func (client *Client) Incrby(ctx context.Context, key string, value int64) (int64, error)
- func (client *Client) LPop(ctx context.Context, key string) (string, error)
- func (client *Client) LPush(ctx context.Context, key string, value string) (int64, error)
- func (client *Client) LRange(ctx context.Context, key string, start int64, end int64) (res []string, err error)
- func (client *Client) MGet(ctx context.Context, param ...string) (res []interface{}, err error)
- func (client *Client) RPop(ctx context.Context, key string) (string, error)
- func (client *Client) RPush(ctx context.Context, key string, value string) (int64, error)
- func (client *Client) SAdd(ctx context.Context, key string, param ...interface{}) (res int64, err error)
- func (client *Client) SDiff(ctx context.Context, param ...string) (res []string, err error)
- func (client *Client) SInter(ctx context.Context, param ...string) (res []string, err error)
- func (client *Client) SIsMember(ctx context.Context, key string, member interface{}) (res bool, err error)
- func (client *Client) SMembers(ctx context.Context, key string) (res []string, err error)
- func (client *Client) SRem(ctx context.Context, key string, param ...interface{}) (res int64, err error)
- func (client *Client) SUnion(ctx context.Context, param ...string) (res []string, err error)
- func (client *Client) SetPersist(ctx context.Context, key string) (res bool, err error)
- func (client *Client) Setex(ctx context.Context, key string, val string, t time.Duration) (bool, error)
- func (client *Client) Setnx(ctx context.Context, key string, val string, t time.Duration) (bool, error)
- func (client *Client) Zadd(ctx context.Context, key string, score float64, member string) (res int64, err error)
- func (client *Client) ZrangeByScore(ctx context.Context, key string, min string, max string, offset int64, ...) (res []string, err error)
- func (client *Client) Zrank(ctx context.Context, key string, member string) (res int64, err error)
- func (client *Client) Zscore(ctx context.Context, key string, member string) (res float64, err error)
- type Config
- type RedisClientITF
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRedisClient ¶
func GetRedisClient(client *Client) (baseClient *redis.Client)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Del ¶
* @Content : 删除key * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-09-09
func (*Client) Eval ¶
func (client *Client) Eval(ctx context.Context, script string, keys []string, args []interface{}) (res interface{}, err error)
* @Content : eval * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-22
func (*Client) Expire ¶
* @Content : 过期设置 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-10-20
func (*Client) HDel ¶
* @Content : HDel * @Param : * @Return : * @Author : LiJunDong * @Time : 2022-02-18
func (*Client) HGet ¶
* @Content : HGet * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-29
func (*Client) HGetAll ¶
* @Content : HGetAll * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-29
func (*Client) HIncrby ¶
func (client *Client) HIncrby(ctx context.Context, key, field string, value int64) (res int64, err error)
* @Content : hash字段incrby * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-26
func (*Client) HMGet ¶
func (client *Client) HMGet(ctx context.Context, key string, field []string) (res []interface{}, err error)
* @Content : HMGet * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-29
func (*Client) HMSet ¶
func (client *Client) HMSet(ctx context.Context, key string, fields map[string]interface{}) (res bool, err error)
* @Content : HMget * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-29
func (*Client) HSet ¶
func (client *Client) HSet(ctx context.Context, table, field string, value interface{}) (int64, error)
* @Content : hash * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-05
func (*Client) Incrby ¶
* @Content : 自增 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-09-09
func (*Client) LPop ¶
* @Content : list头部弹出一个 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-09-09
func (*Client) LPush ¶
* @Content : list头部插入一个 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-09-09
func (*Client) LRange ¶
func (client *Client) LRange(ctx context.Context, key string, start int64, end int64) (res []string, err error)
* @Content : list获取所有 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-09-09
func (*Client) MGet ¶
* @Content : 批量获取 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-10
func (*Client) RPop ¶
* @Content : list尾部弹出一个 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-09-09
func (*Client) RPush ¶
* @Content : list尾部插入一个 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-09-09
func (*Client) SAdd ¶
func (client *Client) SAdd(ctx context.Context, key string, param ...interface{}) (res int64, err error)
* @Content : SAdd * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-11
func (*Client) SDiff ¶
* @Content : 集合取差集 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-11
func (*Client) SInter ¶
* @Content : 集合取交集,暂且不使用redis做交集差集,数值过多可能会造成redis阻塞,相对于redis升级,服务器升级的扩展比较容易 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-11
func (*Client) SMembers ¶
* @Content : SMembers * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-11
func (*Client) SRem ¶
func (client *Client) SRem(ctx context.Context, key string, param ...interface{}) (res int64, err error)
* @Content : SRem * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-11
func (*Client) SUnion ¶
* @Content : 并集 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-11-16
func (*Client) SetPersist ¶
func (*Client) Setex ¶
func (client *Client) Setex(ctx context.Context, key string, val string, t time.Duration) (bool, error)
* @Content : 设置可以有失效时间的string类型 t可以不传 * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-09-09
func (*Client) Setnx ¶
func (client *Client) Setnx(ctx context.Context, key string, val string, t time.Duration) (bool, error)
* @Content : 设置不存在的有失效时间的string类型,如果存在则返回false * @Param : * @Return : * @Author : LiJunDong * @Time : 2021-09-09
func (*Client) ZrangeByScore ¶
type Config ¶
type Config struct { Addr string // 单机链接的地址 Password string // 链接认证 PoolSize int // 链接池大小 MinIdleConns int // 初始化连接数 DB int // DB TimeOut int64 }
<LiJunDong : 2022-03-30 21:21:22> --- redis配置
type RedisClientITF ¶
type RedisClientITF interface { GetClient() (redis.Cmdable, error) Get(string) (string, error) Del(string) bool LRange(string, int64, int64) ([]string, error) MGet(...string) ([]interface{}, error) SMembers(string) ([]string, error) SInter(...string) ([]string, error) SDiff(...string) ([]string, error) SUnion(...string) ([]string, error) HGet(string, string) (string, error) HMGet(string, []string) ([]interface{}, error) HGetAll(string) (map[string]string, error) }