cache

package
v0.6.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Options(
	fx.Provide(newCache),
	fx.Invoke(registerCacheEviction),
)

nolint

Functions

func WithContext

func WithContext(ctx context.Context, cch Cache) context.Context

WithContext returns a copy of ctx with cache associated. If a Cache instance is already in the context, the ctx is not updated.

Types

type Cache

type Cache interface {
	Get(key string) any
	Set(key string, value any, ttl time.Duration)
	Delete(key string)
}

func Ctx

func Ctx(ctx context.Context) Cache

Ctx returns the Cache associated with the ctx. If no cache is associated, an instance is returned, which does nothing.

type Evictor

type Evictor interface {
	Start()
	Stop()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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