cache

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Expiration = cache.Expiration
	WithDepend = cache.WithDepend
)

Functions

func Cache

func Cache(ctx context.Context, config *configs.Config) error

func Default

func Default() cache.Cache

func IsNil

func IsNil(err error) bool

func NewWithConfig

func NewWithConfig(ctx context.Context, cfg *Config, opts ...cache.Option) (cache.Cache, error)

Types

type Config

type Config struct {
	Type
	Addr     string
	Password string
	DB       int
}

type CtxCache

type CtxCache struct {
	cache.Cache
	// contains filtered or unexported fields
}

func Ctx

func Ctx(ctx context.Context) *CtxCache

func (*CtxCache) Del

func (c *CtxCache) Del(key string) error

func (*CtxCache) Get

func (c *CtxCache) Get(key string, opts ...cache.Option) cache.Value

func (*CtxCache) GetOrSet

func (c *CtxCache) GetOrSet(key string, set func() (interface{}, error), opts ...cache.Option) cache.Value

func (*CtxCache) Has

func (c *CtxCache) Has(key string) (bool, error)

func (*CtxCache) Set

func (c *CtxCache) Set(key string, val interface{}, opts ...cache.Option) cache.Value

type Type

type Type string
const (
	Redis Type = "redis"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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