cache

package
v4.47.1 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: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvictOnSuccess added in v4.39.0

func EvictOnSuccess(ctx context.Context, redisClient RedisClient, key string, err error) error

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) App[K, V]

func (App[K, V]) Get

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

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

func (a App[K, V]) List(ctx context.Context, concurrency uint64, items ...K) ([]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