redis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnLockGet = errors.New("lock has already unlocked or expired")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	DBName        string
	DBIndex       int
	Addr          string
	Password      string
	MaxActive     int
	MaxIdle       int
	IdleTimeout   time.Duration
	DialTimeout   time.Duration
	ReadTimeout   time.Duration
	WriteTimeout  time.Duration
	SlowOpTimeout time.Duration
}

type Redis

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

func New

func New(conf *Config) *Redis

func (*Redis) Close

func (r *Redis) Close() error

func (*Redis) Do

func (r *Redis) Do(ctx context.Context, commandName string, args ...interface{}) (interface{}, error)

func (*Redis) ForceUnLock

func (r *Redis) ForceUnLock(ctx context.Context, key string) error

func (*Redis) Lock

func (r *Redis) Lock(ctx context.Context, key string) (err error, gotLock bool, lockValue string)

func (*Redis) UnLock

func (r *Redis) UnLock(ctx context.Context, key, lockValue string) error

Jump to

Keyboard shortcuts

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