Documentation
¶
Overview ¶
Package cache defines a deliberately small cache contract and an in-process implementation. Distributed stores can implement the same four methods.
Index ¶
- Variables
- func GetJSON[T any](ctx context.Context, store Store, key string) (T, error)
- func PutJSON[T any](ctx context.Context, store Store, key string, value T, lifetime time.Duration) error
- func RememberJSON[T any](ctx context.Context, store Store, key string, lifetime time.Duration, ...) (T, error)
- type Memory
- func (memory *Memory) Flush(_ context.Context) error
- func (memory *Memory) Forget(_ context.Context, key string) error
- func (memory *Memory) Get(_ context.Context, key string) ([]byte, error)
- func (memory *Memory) Prune() int
- func (memory *Memory) Put(_ context.Context, key string, value []byte, lifetime time.Duration) error
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMiss = errors.New("cache miss")
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.