Documentation ¶
Index ¶
- func Do(args ...interface{}) (cmd *redis.Cmd)
- func Exists(key string) (yes bool)
- func Get(key string) (val string)
- func GetClient() redis.Cmdable
- func GetClientFor(readOnly bool) redis.Cmdable
- func GetClientForWrite() redis.Cmdable
- func GetRedisRd() redis.Cmdable
- func GetRedisRw() redis.Cmdable
- func HashDel(key, field string)
- func HashExists(key, field string) bool
- func HashGet(key, field string) (st *redis.StringCmd)
- func HashPut(key, field string, val interface{})
- func IsStarted() bool
- func ListGet(key string) (list []interface{})
- func ListPut(key string, val interface{})
- func PipelineExec(fn func(pipeline redis.Pipeliner) (err error)) (err error)
- func Publish(channel string, message interface{}) *redis.IntCmd
- func Put(key string, val interface{})
- func Start(opts ...RedisOpOpt)
- func StartWithConfig(config *Config)
- func Stop()
- func Subscribe(channels ...string) (pubsub *redis.PubSub)
- func TxPipelineExec(fn func(pipeline redis.Pipeliner) (err error)) (err error)
- func Watch(fn func(*redis.Tx) error, keys ...string) error
- type Config
- type RedisOpOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClientFor ¶
func GetClientForWrite ¶
func GetRedisRd ¶
func GetRedisRw ¶
func HashExists ¶
func Start ¶
func Start(opts ...RedisOpOpt)
func StartWithConfig ¶
func StartWithConfig(config *Config)
func TxPipelineExec ¶
Types ¶
type Config ¶
type Config struct { Peers string `yaml:"peers"` Username string `yaml:"user"` Password string `yaml:"pass"` Db int `yaml:"db"` ReadonlyRoute bool `yaml:"readonly-route"` DialTimeout time.Duration `yaml:"dial-timeout"` ReadTimeout time.Duration `yaml:"read-timeout"` WriteTimeout time.Duration `yaml:"write-timeout"` EnableCluster bool `yaml:"enable-cluster"` }
type RedisOpOpt ¶
type RedisOpOpt func(hub *hubStruct)
func WithPrefixKey ¶
func WithPrefixKey(prefixKey string) RedisOpOpt
WithPrefixKey specify the prefix key of cmdr options store.
For prefixKey="mqtt.server.storage.redis", the config structure might be:
app: mqtt: server: storage: what: redis redis: devel: peers: localhost:6379 readonly-route: true # read-write separately enable-cluster: # for redis cluster, it must be true devel-95: peers: 192.168.0.95:6379 user: pass: db: dial-timeout: read-timeout: write-timeout: readonly-route: enable-cluster:
Click to show internal directories.
Click to hide internal directories.