redisWrapper

package
v0.0.0-...-e0f34cb Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Publish

func Publish(ctx context.Context, cli interface{}, clusterFlag bool, channelName, message string) error

Publish publish to redis

func Subscrible

func Subscrible(ctx context.Context, cli interface{}, clusterFlag bool, cb SubscriberCallback, channelName ...string) error

Subscrible subscribe

Types

type RedisClient

type RedisClient struct {
	RedisCfg []RedisConfig
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg []RedisConfig) (*RedisClient, error)

func (*RedisClient) Bpop

func (cli *RedisClient) Bpop(mqName []string, timeout uint32) (string, error)

阻塞式从队列首读取一个元素,支持多个队列设置优先级

func (*RedisClient) CheckRedisConPeriod

func (cli *RedisClient) CheckRedisConPeriod()

func (*RedisClient) Close

func (cli *RedisClient) Close() error

func (*RedisClient) Connect

func (cli *RedisClient) Connect() error

func (*RedisClient) GetKeys

func (cli *RedisClient) GetKeys(pattern string) ([]string, error)

func (*RedisClient) HKeys

func (cli *RedisClient) HKeys(hashMapName string) ([]string, error)

func (*RedisClient) HVals

func (cli *RedisClient) HVals(hashMapName string) ([]string, error)

func (*RedisClient) Hdel

func (cli *RedisClient) Hdel(hashMapName, key string) error

func (*RedisClient) Hget

func (cli *RedisClient) Hget(hashMapName, key string) (string, error)

func (*RedisClient) Hmget

func (cli *RedisClient) Hmget(hashMapName string, keys []string) ([]string, error)

func (*RedisClient) Hset

func (cli *RedisClient) Hset(hashMapName, key, value string) error

func (*RedisClient) Lock

func (cli *RedisClient) Lock(key, value string, lifeTime uint64) error

func (*RedisClient) Pop

func (cli *RedisClient) Pop(mqName string) (string, error)

func (*RedisClient) Push

func (cli *RedisClient) Push(mqName, message string) error

func (*RedisClient) Sadd

func (cli *RedisClient) Sadd(key, value string) error

func (*RedisClient) Smembers

func (cli *RedisClient) Smembers(key string) ([]string, error)

func (*RedisClient) Srem

func (cli *RedisClient) Srem(key, value string) error

func (*RedisClient) UnLock

func (cli *RedisClient) UnLock(key string) error

type RedisConfig

type RedisConfig struct {
	RedisServerIP   string `json:"redisServerIP"`
	RedisServerPort string `json:"redisServerPort"`
	RedisConnType   string `json:"redisConnType"`
	RedisServerPass string `json:"redisServerPass"`
}

type SubscriberCallback

type SubscriberCallback func(channel, message string)

SubscriberCallback subscriber callback function

Jump to

Keyboard shortcuts

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