cache

package
v4.47.3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 10 Imported by: 5 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIgnore = errors.New("ignore error")
)

Functions

This section is empty.

Types

type App

type App[K any, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[K any, V any](client RedisClient, toKey func(K) string, onMiss func(context.Context, K) (V, error), ttl time.Duration, concurrency uint64, tracer trace.Tracer) App[K, V]

func (App[K, V]) EvictOnSuccess added in v4.47.2

func (a App[K, V]) EvictOnSuccess(ctx context.Context, item K, err error) error

func (App[K, V]) Get

func (a App[K, V]) Get(ctx context.Context, id K) (V, error)

func (App[K, V]) List added in v4.47.1

func (a App[K, V]) List(ctx context.Context, items ...K) ([]V, error)

func (App[K, V]) Store added in v4.47.3

func (a App[K, V]) Store(ctx context.Context, id K, value V) error

type RedisClient added in v4.28.0

type RedisClient interface {
	Load(ctx context.Context, key string) ([]byte, error)
	LoadMany(ctx context.Context, keys ...string) ([]string, error)
	Store(ctx context.Context, key string, value any, ttl time.Duration) error
	Delete(ctx context.Context, keys ...string) error
}

Jump to

Keyboard shortcuts

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