Documentation
¶
Overview ¶
Package memstore provides a generic thread-safe in-memory key-value store.
Index ¶
- type Store
- func (s *Store[V]) All() map[string]V
- func (s *Store[V]) Clear()
- func (s *Store[V]) Delete(key string) bool
- func (s *Store[V]) Filter(fn func(key string, value V) bool) map[string]V
- func (s *Store[V]) Get(key string) (V, bool)
- func (s *Store[V]) Has(key string) bool
- func (s *Store[V]) Keys() []string
- func (s *Store[V]) Len() int
- func (s *Store[V]) Set(key string, value V)
- func (s *Store[V]) SetIfAbsent(key string, value V) bool
- func (s *Store[V]) Update(key string, fn func(V) V) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store[V any] struct { // contains filtered or unexported fields }
Store is a generic thread-safe in-memory key-value store.
func (*Store[V]) SetIfAbsent ¶
SetIfAbsent stores a value only if the key does not already exist. Returns true if set.
Click to show internal directories.
Click to hide internal directories.