cache

package
v4.35.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnModify added in v4.28.0

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

OnModify handle an item update and evict the cache for given key

func Retrieve added in v4.28.0

func Retrieve(ctx context.Context, redisClient RedisClient, key string, item interface{}, onMiss func() (interface{}, error), duration time.Duration) (interface{}, error)

Retrieve loads an item from the cache for given key or retrieve it (and store it in cache after)

Types

type RedisClient added in v4.28.0

type RedisClient interface {
	Load(ctx context.Context, key string) (string, error)
	Store(ctx context.Context, key string, value interface{}, duration time.Duration) error
	Delete(ctx context.Context, keys ...string) error
}

RedisClient for caching response

Jump to

Keyboard shortcuts

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