redis

package
v0.0.0-...-048a247 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Nil = redis.Nil

Functions

This section is empty.

Types

type Instance

type Instance interface {
	Ping(ctx context.Context) error
	Get(ctx context.Context, key Key) (string, error)
	Set(ctx context.Context, key Key, value interface{}) error
	SetEX(ctx context.Context, key Key, value interface{}, expiry time.Duration) error
	Exists(ctx context.Context, keys ...Key) (int, error)
	IncrBy(ctx context.Context, key Key, amount int) (int, error)
	DecrBy(ctx context.Context, key Key, amount int) (int, error)
	Expire(ctx context.Context, key Key, expiry time.Duration) error
	Del(ctx context.Context, keys ...Key) (int, error)
	TTL(ctx context.Context, key Key) (time.Duration, error)
	Pipeline(ctx context.Context) redis.Pipeliner
	Subscribe(ctx context.Context, ch chan string, subscribeTo ...Key)
	ComposeKey(svc string, args ...string) Key
	Mutex(name Key, ex time.Duration) *redsync.Mutex
	RawClient() *redis.Client
}

func Setup

func Setup(ctx context.Context, opt SetupOptions) (Instance, error)

type Key

type Key string

func (Key) String

func (k Key) String() string

type SetupOptions

type SetupOptions struct {
	MasterName string
	Username   string
	Password   string
	Database   int

	Addresses []string
	Sentinel  bool

	EnableSync bool
}

Jump to

Keyboard shortcuts

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