redis

package
v1.3.12 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	redis.Cmdable
}

func NewRedis

func NewRedis(o *Config) (client *Client, err error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Process

func (c *Client) Process(cmd redis.Cmder) error

type Config

type Config struct {
	PoolSize     int           `yaml:"poolSize"`
	Addr         []string      `yaml:"addr"`
	Pwd          string        `yaml:"pwd"`
	DialTimeout  time.Duration `yaml:"DialTimeout"`
	ReadTimeout  time.Duration `yaml:"ReadTimeout"`
	WriteTimeout time.Duration `yaml:"WriteTimeout"`
}

type RedisLock

type RedisLock struct {
	// contains filtered or unexported fields
}

func NewRedisLock

func NewRedisLock(conn redis.Cmdable, key, val string, timeout time.Duration) *RedisLock

func (*RedisLock) GetLockKey

func (lock *RedisLock) GetLockKey() string

func (*RedisLock) GetLockVal

func (lock *RedisLock) GetLockVal() string

func (*RedisLock) TryLock

func (lock *RedisLock) TryLock() (bool, error)

TryLock return true ===> Get the lock successfully

func (*RedisLock) UnLock

func (lock *RedisLock) UnLock() error

Jump to

Keyboard shortcuts

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