cachex

package
v0.0.0-...-1b17b00 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(ctx context.Context, ns, key, value string, expiration ...time.Duration) error
	Get(ctx context.Context, ns, key string) (string, bool, error)
	GetAndDelete(ctx context.Context, ns, key string) (string, bool, error)
	Exists(ctx context.Context, ns, key string) (bool, error)
	Delete(ctx context.Context, ns, key string) error
	Iterator(ctx context.Context, ns string, fn func(ctx context.Context, key, value string) bool) error
	Close(ctx context.Context) error
	Pipelined(ctx context.Context, fn func(redis.Pipeliner) error) ([]redis.Cmder, error)
	RPop(ctx context.Context, ns, key string) (string, error)
	LPush(ctx context.Context, ns, key, value string) error
	TxPipeline() redis.Pipeliner
	Pipeline() redis.Pipeliner
}

Cache is the interface that wraps the basic Get, Set, and Delete methods.

func NewRedisCacheWithClient

func NewRedisCacheWithClient(cli *redis.Client, opts ...Option) Cache

NewRedisCacheWithClient Use redis client create cache

func NewRedisCacheWithClusterClient

func NewRedisCacheWithClusterClient(cli *redis.ClusterClient, opts ...Option) Cache

NewRedisCacheWithClusterClient Use redis cluster client create cache

type Option

type Option func(*options)

func WithDelimiter

func WithDelimiter(delimiter string) Option

Jump to

Keyboard shortcuts

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