Documentation ¶
Overview ¶
Package defines Store interface for cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryStore ¶
type MemoryStore[V any] struct { // contains filtered or unexported fields }
A cache store that stores cached values in memory.
Thanks to sync.Map, this cache store is safe for concurrent use by multiple goroutines.
type Store ¶
type Store[K, V any] interface { // Get a cached value with a key. // The returned value needs to be wraped with Value that represents hit or miss. Get(ctx context.Context, key K) (value Value[V], err error) // Store a value with a key. Set(ctx context.Context, key K, value V) (err error) }
An interface that defines the behavior of a key-value cache store.
Click to show internal directories.
Click to hide internal directories.