cache

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCacheType = errors.New("invalid cache type")
	ErrCacheProcessing  = errors.New("cache processing error")
)

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Load returns cached string by using the key, and whether or not cache is expired. If a cache is empty,
	// returned a string is nil and expired is true.
	Load(ctx context.Context, key string, decrypt bool) (*string, bool, error)

	// Save saves value to cache. If encrypt is true, value is encrypted before saving.
	Save(ctx context.Context, key string, value *string, encrypt bool) error
}

func New

func New(cfg config.CacheConfig, options ...Option) (Cache, error)

type Option added in v0.4.0

type Option func(*opts)

Option is configurable Cache behavior.

func WithCacheKeys added in v0.4.0

func WithCacheKeys(keys ...string) Option

WithCacheKeys sets the keys to be used in the cache.

Jump to

Keyboard shortcuts

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