Documentation ¶
Index ¶
- func Del(key string) (int64, error)
- func Get(key string) (string, error)
- func Info() (string, error)
- func Ping() (string, error)
- func Publish(channel, message string) error
- func Set(key, value string, expiration time.Duration) error
- func SetRedisClusterConfig(cfg RedisClusterConfig)
- func SetRedisConfig(cfg RedisConfig)
- func Subscribe(channels string, cb func(channel string, message string, err error)) error
- type RedisCache
- func (c RedisCache) Del(key string) (int64, error)
- func (c RedisCache) Get(key string) (string, error)
- func (c RedisCache) Info() (string, error)
- func (c RedisCache) Ping() (string, error)
- func (c RedisCache) Publish(channel, message string) error
- func (c RedisCache) Set(key, value string, expiration time.Duration) error
- func (c RedisCache) Subscribe(channels string, cb func(channel string, message string, err error)) error
- type RedisClusterConfig
- type RedisConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetRedisClusterConfig ¶
func SetRedisClusterConfig(cfg RedisClusterConfig)
SetRedisClusterConfig set
Types ¶
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
RedisCache define
func NewRedisClusterCache ¶
func NewRedisClusterCache() *RedisCache
NewRedisClusterCache new RedisCluster object
func (RedisCache) Get ¶
func (c RedisCache) Get(key string) (string, error)
Get get value from cache
func (RedisCache) Publish ¶
func (c RedisCache) Publish(channel, message string) error
Publish publish message
type RedisClusterConfig ¶
type RedisClusterConfig struct { // A seed list of host:port addresses of cluster nodes. Addrs []string UserName string Password string DB int // The maximum number of retries before giving up. Command is retried // on network errors and MOVED/ASK redirects. // Default is 16. MaxRedirects int // Enables read-only commands on slave nodes. ReadOnly bool // Allows routing read-only commands to the closest master or slave node. RouteByLatency bool MaxRetries int MinRetryBackoff time.Duration MaxRetryBackoff time.Duration DialTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration // PoolSize applies per cluster node and not for the whole cluster. PoolSize int PoolTimeout time.Duration IdleTimeout time.Duration IdleCheckFrequency time.Duration }
RedisClusterConfig redis cluster configure
Click to show internal directories.
Click to hide internal directories.