redis

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NOEXPIRE = time.Duration(0)

Functions

This section is empty.

Types

type Cache

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

func NewRedisCache

func NewRedisCache(
	logger log.Logger,
	addr string,
	options ...Option,
) (*Cache, error)

func (Cache) Add

func (c Cache) Add(
	cx context.Context,
	key string,
	value []byte,
) error

func (Cache) Delete

func (c Cache) Delete(
	cx context.Context,
	key string,
)

func (Cache) Get

func (c Cache) Get(cx context.Context, key string) (val []byte, found bool)

func (Cache) Replace

func (c Cache) Replace(
	cx context.Context,
	key string,
	value []byte,
) error

func (Cache) Set

func (c Cache) Set(cx context.Context, key string, val []byte)

func (Cache) SetWithDuration

func (c Cache) SetWithDuration(
	cx context.Context,
	key string,
	val []byte,
	expiration time.Duration,
)

type Option

type Option func(*cache)

func WithDatabase

func WithDatabase(db int) Option

func WithOnConnect

func WithOnConnect(callback func(context.Context, *redis.Conn) error) Option

func WithPassword

func WithPassword(password string) Option

Jump to

Keyboard shortcuts

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