redisop

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(args ...interface{}) (cmd *redis.Cmd)

func Exists

func Exists(key string) (yes bool)

func Get

func Get(key string) (val string)

func GetClient

func GetClient() redis.Cmdable

func GetClientFor

func GetClientFor(readOnly bool) redis.Cmdable

func GetClientForWrite

func GetClientForWrite() redis.Cmdable

func GetRedisRd

func GetRedisRd() redis.Cmdable

func GetRedisRw

func GetRedisRw() redis.Cmdable

func HashDel

func HashDel(key, field string)

func HashExists

func HashExists(key, field string) bool

func HashGet

func HashGet(key, field string) (st *redis.StringCmd)

func HashPut

func HashPut(key, field string, val interface{})

func IsStarted

func IsStarted() bool

func ListGet

func ListGet(key string) (list []interface{})

func ListPut

func ListPut(key string, val interface{})

func PipelineExec

func PipelineExec(fn func(pipeline redis.Pipeliner) (err error)) (err error)

func Publish

func Publish(channel string, message interface{}) *redis.IntCmd

func Put

func Put(key string, val interface{})

func Start

func Start(opts ...RedisOpOpt)

func StartWithConfig

func StartWithConfig(config *Config)

func Stop

func Stop()

func Subscribe

func Subscribe(channels ...string) (pubsub *redis.PubSub)

func TxPipelineExec

func TxPipelineExec(fn func(pipeline redis.Pipeliner) (err error)) (err error)

func Watch

func Watch(fn func(*redis.Tx) error, keys ...string) error

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:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL