Documentation ¶
Index ¶
- func Delete(key interface{})
- func Load(key interface{}) (value interface{}, ok bool)
- func LoadAndDelete(key interface{}) (value interface{}, loaded bool)
- func LoadOrStore(key, value interface{}) (actual interface{}, loaded bool)
- func Range(f func(key, value interface{}) bool)
- func RedisCloseSubscribe() error
- func RedisClusterInfo() (string, error)
- func RedisDel(keys ...string) (int64, error)
- func RedisGet(k string) (string, error)
- func RedisInfo(section ...string) (string, error)
- func RedisPublish(channel string, message interface{}) (int64, error)
- func RedisReceiveSubscribeMessage() (channel, message string, err error)
- func RedisReconnect() (string, error)
- func RedisSet(k, v string, expiration time.Duration) (string, error)
- func RedisSubscribe(channels ...string) error
- func RedisUnsubscribe(channels ...string) error
- func SetDefaultRedisClusterOption(opt RedisClusterOptions) (err error)
- func SetDefaultRedisOption(opt RedisOptions) (err error)
- func Store(key, value interface{})
- type RedisCache
- func (c *RedisCache) CloseSubscribe() error
- func (c RedisCache) ClusterInfo() (string, error)
- func (c RedisCache) Del(ks ...string) (int64, error)
- func (c RedisCache) Get(k string) (string, error)
- func (c RedisCache) Info(section ...string) (string, error)
- func (c RedisCache) Publish(channel string, message interface{}) (int64, error)
- func (c *RedisCache) ReceiveSubscribeMessage() (channel, message string, err error)
- func (c RedisCache) Reconnect() (s string, err error)
- func (c RedisCache) Set(k, v string, expiration time.Duration) (string, error)
- func (c *RedisCache) Subscribe(channels ...string) error
- func (c *RedisCache) Unsubscribe(channels ...string) error
- type RedisClusterOptions
- type RedisOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load(key interface{}) (value interface{}, ok bool)
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func LoadAndDelete ¶
func LoadAndDelete(key interface{}) (value interface{}, loaded bool)
LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present.
func LoadOrStore ¶
func LoadOrStore(key, value interface{}) (actual interface{}, loaded bool)
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func Range ¶
func Range(f func(key, value interface{}) bool)
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
func RedisPublish ¶
Publish posts the message to the channel.
func RedisReceiveSubscribeMessage ¶
RedisReceiveSubscribeMessage returns a Message or error ignoring Subscription and Pong messages. This is low-level API and in most cases Channel should be used instead.
func RedisSubscribe ¶
Subscribe subscribes the client to the specified channels.
func RedisUnsubscribe ¶
Unsubscribe the client from the given channels, or from all of them if none is given.
func SetDefaultRedisClusterOption ¶
func SetDefaultRedisClusterOption(opt RedisClusterOptions) (err error)
SetDefaultRedisClusterOption set default cluster option
func SetDefaultRedisOption ¶
func SetDefaultRedisOption(opt RedisOptions) (err error)
SetDefaultRedisOption set default option
Types ¶
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
RedisCache define
func NewRedisCache ¶
func NewRedisCache(opt RedisOptions) (rc *RedisCache, err error)
NewRedisCache new RedisCache object
func NewRedisClusterCache ¶
func NewRedisClusterCache(opt RedisClusterOptions) (rc *RedisCache, err error)
NewRedisClusterCache new RedisCluster object
func (*RedisCache) CloseSubscribe ¶
func (c *RedisCache) CloseSubscribe() error
CloseSubscribe close
func (RedisCache) ClusterInfo ¶
func (c RedisCache) ClusterInfo() (string, error)
ClusterInfo redis cluster info
func (RedisCache) Del ¶
func (c RedisCache) Del(ks ...string) (int64, error)
Del delete key from cache
func (RedisCache) Info ¶
func (c RedisCache) Info(section ...string) (string, error)
Info redis info
func (RedisCache) Publish ¶
func (c RedisCache) Publish(channel string, message interface{}) (int64, error)
Publish posts the message to the channel.
func (*RedisCache) ReceiveSubscribeMessage ¶
func (c *RedisCache) ReceiveSubscribeMessage() (channel, message string, err error)
ReceiveSubscribeMessage returns a Message or error ignoring Subscription and Pong messages. This is low-level API and in most cases Channel should be used instead.
func (RedisCache) Reconnect ¶
func (c RedisCache) Reconnect() (s string, err error)
Reconnect reconnect
func (*RedisCache) Subscribe ¶
func (c *RedisCache) Subscribe(channels ...string) error
Subscribe subscribes the client to the specified channels.
func (*RedisCache) Unsubscribe ¶
func (c *RedisCache) Unsubscribe(channels ...string) error
Unsubscribe the client from the given channels, or from all of them if none is given.
type RedisClusterOptions ¶
type RedisClusterOptions struct { DB int PoolSize int MaxRetries int MinRetryBackoff time.Duration MaxRetryBackoff time.Duration DialTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration PoolTimeout time.Duration IdleTimeout time.Duration IdleCheckFrequency time.Duration Password string Addrs []string }
RedisClusterOptions cluster option