cache

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Cache

func Cache() cago.Component

func Default

func Default() cache2.Cache

func IsNil

func IsNil(err error) bool

func NewWithConfig

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

Types

type Config

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

type CtxCache

type CtxCache struct {
	cache2.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 ...cache2.Option) cache2.Value

func (*CtxCache) GetOrSet

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

func (*CtxCache) Has

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

func (*CtxCache) Set

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

type Type

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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