Documentation
¶
Index ¶
- Constants
- func ValueDecode(coder ValueCoder, o []byte, v interface{}) error
- func ValueEncode(coder ValueCoder, v interface{}) interface{}
- type CompressCoder
- type Config
- type JsonCoder
- type Redis
- func (r *Redis) GetByCoder(key string, val interface{}) error
- func (r *Redis) GetRaw(key string) ([]byte, error)
- func (r *Redis) GetSetByCoder(key string, val interface{}, newVal interface{}) error
- func (r *Redis) HGetByCoder(key, field string, val interface{}) error
- func (r *Redis) HGetRaw(key string, fields string) ([]byte, error)
- func (r *Redis) HSetByCoder(key, field string, value interface{}) error
- func (r *Redis) SetByCoder(key string, value interface{}, expire time.Duration) error
- func (self *Redis) UseValueCoder(coder ValueCoder) *Redis
- type ValueCoder
Constants ¶
View Source
const ( //ClusterMode using clusterClient ClusterMode string = "cluster" //StubMode using reidsClient StubMode string = "stub" )
Variables ¶
This section is empty.
Functions ¶
func ValueDecode ¶
func ValueDecode(coder ValueCoder, o []byte, v interface{}) error
func ValueEncode ¶
func ValueEncode(coder ValueCoder, v interface{}) interface{}
Types ¶
type CompressCoder ¶
type CompressCoder struct { }
func (*CompressCoder) DeCoder ¶
func (c *CompressCoder) DeCoder(o []byte, v interface{}) error
func (*CompressCoder) Encoder ¶
func (c *CompressCoder) Encoder(v interface{}) (bytes []byte, err error)
type Config ¶
type Config struct { // Addrs 实例配置地址 Addrs []string `json:"addrs" toml:"addrs"` // Mode Redis模式 cluster|stub Mode string `json:"mode" toml:"mode"` // Password 密码 Password string `json:"password" toml:"password"` // DB,默认为0, 一般应用不推荐使用DB分片 DB int `json:"db" toml:"db"` // PoolSize 集群内每个节点的最大连接池限制 默认每个CPU10个连接 PoolSize int `json:"poolSize" toml:"poolSize"` // MaxRetries 网络相关的错误最大重试次数 默认8次 MaxRetries int `json:"maxRetries" toml:"maxRetries"` // MinIdleConns 最小空闲连接数 MinIdleConns int `json:"minIdleConns" toml:"minIdleConns"` // DialTimeout 拨超时时间 DialTimeout time.Duration `json:"dialTimeout" toml:"dialTimeout"` // ReadTimeout 读超时 默认3s ReadTimeout time.Duration `json:"readTimeout" toml:"readTimeout"` // WriteTimeout 读超时 默认3s WriteTimeout time.Duration `json:"writeTimeout" toml:"writeTimeout"` // IdleTimeout 连接最大空闲时间,默认60s, 超过该时间,连接会被主动关闭 IdleTimeout time.Duration `json:"idleTimeout" toml:"idleTimeout"` // 慢日志门限值,超过该门限值的请求,将被记录到慢日志中 SlowThreshold time.Duration `json:"slowThreshold" toml:"slowThreshold"` // contains filtered or unexported fields }
Config for kredis, contains RedisStubConfig and RedisClusterConfig
type Redis ¶
type Redis struct { redis.Cmdable Config *Config ValueCoder ValueCoder }
Redis client (cmdable and config)
func (*Redis) GetByCoder ¶
Get(key string) *StringCmd
func (*Redis) GetSetByCoder ¶
func (*Redis) HGetByCoder ¶
func (*Redis) HSetByCoder ¶
func (*Redis) SetByCoder ¶
func (*Redis) UseValueCoder ¶
func (self *Redis) UseValueCoder(coder ValueCoder) *Redis
Click to show internal directories.
Click to hide internal directories.