Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store[T any] struct { // contains filtered or unexported fields }
Store defines a concurrent safe in memory key-value data store.
func (*Store[T]) Get ¶
Get returns a single element value from the store.
If key is not set, the zero T value is returned.
func (*Store[T]) Remove ¶
Remove removes a single entry from the store.
Remove does nothing if key doesn't exist in the store.
func (*Store[T]) RemoveAll ¶
func (s *Store[T]) RemoveAll()
RemoveAll removes all the existing store entries.
func (*Store[T]) SetIfLessThanLimit ¶
SetIfLessThanLimit sets (or overwrite if already exist) a new value for key.
This method is similar to Set() but **it will skip adding new elements** to the store if the store length has reached the specified limit. `false` is returned if maxAllowedElements limit is reached.
Click to show internal directories.
Click to hide internal directories.