Documentation ¶
Overview ¶
一些简单的扩展封装
Index ¶
- func DefaultDialOpts() []redis.DialOption
- type Client
- func (c *Client) Do(cmd string, args ...interface{}) (res interface{}, err error)
- func (c *Client) Execute(fn ExecuteFunc) (res interface{}, err error)
- func (c *Client) IntGet(key string) (int, error)
- func (c *Client) IntSet(key string, val int) (interface{}, error)
- func (c *Client) Mode() string
- func (c *Client) StringGet(key string) (string, error)
- func (c *Client) StringSet(key, val string) (interface{}, error)
- func (c *Client) Subscribe(fn SubscribeFunc) error
- type ExecuteFunc
- type ModeInterface
- type PoolOption
- func DefaultPoolOpts() []PoolOption
- func IdleTimeout(value time.Duration) PoolOption
- func MaxActive(value int) PoolOption
- func MaxConnLifetime(value time.Duration) PoolOption
- func MaxIdle(value int) PoolOption
- func TestOnBorrow(value func(c redis.Conn, t time.Time) (err error)) PoolOption
- func Wait(value bool) PoolOption
- type SubscribeFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(mode ModeInterface) *Client
func (*Client) Execute ¶
func (c *Client) Execute(fn ExecuteFunc) (res interface{}, err error)
func (*Client) Mode ¶
Mode 当前客户端使用模式 alone 单机或者代理入口模式 cluster Redis-Cluster集群模式 sentinel Redis-Sentinel哨兵模式
func (*Client) Subscribe ¶
func (c *Client) Subscribe(fn SubscribeFunc) error
type ExecuteFunc ¶
ExecuteFunc 普通回调函数
type ModeInterface ¶
ModeInterface
type PoolOption ¶
PoolOption 连接池配置函数
func MaxConnLifetime ¶
func MaxConnLifetime(value time.Duration) PoolOption
MaxConnLifetime 连接生命周期, 超过后关闭连接
func TestOnBorrow ¶
TestOnBorrow 健康检查, 检测连接是否可用
Click to show internal directories.
Click to hide internal directories.