Documentation ¶
Overview ¶
下面封装一些常用的命令函数,不常用的自己用标准的调用方法。
Index ¶
- type ConnCnf
- type GfRedis
- func (rdx *GfRedis) Del(key string) (int64, error)
- func (rdx *GfRedis) Expire(key string, seconds time.Duration) (bool, error)
- func (rdx *GfRedis) Get(key string) (string, error)
- func (rdx *GfRedis) Ping() (string, error)
- func (rdx *GfRedis) Set(key string, value any, seconds time.Duration) (string, error)
- func (rdx *GfRedis) SetEX(key string, value any, seconds time.Duration) (string, error)
- func (rdx *GfRedis) SetNX(key string, value any, seconds time.Duration) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnCnf ¶
type ConnCnf struct { // single redis Addr string `v:"match=ipv4:port"` // sentinel SentinelAddrs []string `v:"match=ipv4:port"` MasterName string `v:""` SentinelPass string `v:""` SlaveOnly bool `v:""` // common Pass string `v:"required"` DB int `v:""` PoolSize int `v:""` MinIdle int `v:""` // 扩展:节点的权重 Weight uint16 `v:""` // 权重 }
go-redis
type GfRedis ¶
go-redis
func NewGoRedis ¶
直接连接redis go-redis 底层自带连接池功能,不需要你再管理了。 看看 go-redis/redis.go 中的代码: 第330行 func (c *baseClient) process(ctx context.Context, cmd Cmder) 第288行 func (c *baseClient) withConn( 第292行 cn, err := c.getConn(ctx)
Click to show internal directories.
Click to hide internal directories.