cache

package
v2.0.23 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 15 Imported by: 5

Documentation

Index

Constants

View Source
const (
	PROVIDER_GO_CACHE = gocache.AppName
	PROVIDER_REDIS    = redis.AppName
)
View Source
const (
	AppName = "cache"
)

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

func Get added in v2.0.8

func Get() *cache

Types

type Cache

type Cache interface {
	Set(ctx context.Context, key string, value any, options ...SetOption) error
	IncrBy(ctx context.Context, key string, value int64) (int64, error)
	Get(ctx context.Context, key string, value any) error
	Exist(ctx context.Context, key string) error
	Del(ctx context.Context, keys ...string) error
}

func C

func C() Cache

type Getter added in v2.0.18

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

func NewGetter added in v2.0.18

func NewGetter(ctx context.Context, f ObjectFinder) *Getter

func (*Getter) Get added in v2.0.18

func (g *Getter) Get(key string, value any) error

func (*Getter) GetKey added in v2.0.18

func (g *Getter) GetKey(key string) string

func (*Getter) WithNamespace added in v2.0.18

func (g *Getter) WithNamespace(namespace string) *Getter

func (*Getter) WithResourceType added in v2.0.18

func (g *Getter) WithResourceType(resourceType string) *Getter

func (*Getter) WithTTL added in v2.0.18

func (g *Getter) WithTTL(ttl int64) *Getter

type ObjectFinder added in v2.0.18

type ObjectFinder func(ctx context.Context, objectId string) (any, error)

type PROVIDER

type PROVIDER string

type SetOption

type SetOption func(*options)

func WithExpiration

func WithExpiration(expiration int64) SetOption

Jump to

Keyboard shortcuts

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