Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = store.ErrNotFound
ErrNotFound indicates that key not found in the cache.
Functions ¶
This section is empty.
Types ¶
type Cache ¶ added in v0.0.4
type Cache[KeyType comparable, ValueType any] interface { Get(KeyType) (ValueType, error) Set(KeyType, ValueType) error Delete(KeyType) error Clear() error GetWithContext(context.Context, KeyType) (ValueType, error) SetWithContext(context.Context, KeyType, ValueType) error DeleteWithContext(context.Context, KeyType) error ClearWithContext(context.Context) error SetHasher(hasher.Hasher) SetMarshaler(marshaler.Marshaler) }
Cache represents the interface for all caches
func New ¶ added in v0.0.4
func New[K comparable, V any](s store.Store) Cache[K, V]
New creates a new instance of cache object.
func NewMapCache ¶ added in v0.0.6
func NewMapCache[K comparable, V any](size int) Cache[K, V]
NewMapCache creates a new instance of cache object with the MapStore as a data store. MapStore is like a Go map but is safe for concurrent use by multiple goroutines.
Click to show internal directories.
Click to hide internal directories.