redisx

package
v0.0.0-...-93b0e25 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRedis

func GetRedis() redis.Cmdable

func InitLock

func InitLock() error

func InitRedis

func InitRedis(cfg *Config)

func Obtain

func Obtain(ctx context.Context, key string, ttl time.Duration, opt *redislock.Options) (*redislock.Lock, error)

func Publish

func Publish(ctx context.Context, rds redis.Cmdable, channel string, message interface{}) error

func Subscribe

func Subscribe(ctx context.Context, rds redis.Cmdable, call func(obj interface{}, chanel, payload string), obj interface{}, channels ...string)

Types

type Cmdable

type Cmdable redis.Cmdable

type Config

type Config struct {
	Addrs      []string `yaml:"Addrs"`      // 集群地址配置
	Password   string   `yaml:"Password" `  // 密码
	Model      string   `yaml:"Model"`      // 部署模式->单机:standaloan 哨兵:sentinel 集群:cluster
	MasterName string   `yaml:"MasterName"` // 主从故障模式特有
}

Jump to

Keyboard shortcuts

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