cache

package
v1.409.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

Module for fx.

Functions

func Get added in v1.406.0

func Get[T any](ctx context.Context, key string) (*T, error)

Get a value from key.

func New added in v1.405.0

func New(params Params) (config.Cache, error)

New from config.

func Persist added in v1.406.0

func Persist[T any](ctx context.Context, key string, value *T, ttl time.Duration) error

Persist a value to the key with a TTL.

func Register added in v1.406.0

func Register(ca config.Cache)

Register a cache.

func Remove added in v1.406.0

func Remove(ctx context.Context, key string) error

Remove a key.

Types

type Cache added in v1.404.0

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

Cache allows marshaling and compressing items to the cache.

func (*Cache) Close added in v1.407.0

func (c *Cache) Close(_ context.Context) error

Close the cache.

func (*Cache) Get added in v1.407.0

func (c *Cache) Get(_ context.Context, key string, value any) error

Get a cached value.

func (*Cache) Persist added in v1.407.0

func (c *Cache) Persist(_ context.Context, key string, value any, ttl time.Duration) error

Persist a value with key and TTL.

func (*Cache) Remove added in v1.407.0

func (c *Cache) Remove(_ context.Context, key string) error

Remove a cached key.

type Params added in v1.405.0

type Params struct {
	fx.In

	Lifecycle  fx.Lifecycle
	Config     *config.Config
	Encoder    *encoding.Map
	Pool       *sync.BufferPool
	Compressor *compress.Map
	Cache      cachego.Cache
	Tracer     trace.Tracer
	Logger     *zap.Logger
	Meter      metric.Meter
}

Params for cache.

Directories

Path Synopsis
telemetry

Jump to

Keyboard shortcuts

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