Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultCache ¶ added in v2.6.0
type DefaultCache[T any] struct { // contains filtered or unexported fields }
DefaultCache is an implementation of Cache that stores all values in a map.
func (*DefaultCache[T]) Delete ¶ added in v2.6.0
func (s *DefaultCache[T]) Delete(key string)
Delete removes an entry from the cache with the specified key. It acquires an exclusive write lock to ensure exclusive access during the deletion.
func (*DefaultCache[T]) Get ¶ added in v2.6.0
func (s *DefaultCache[T]) Get(key string) (T, bool)
Get retrieves the value associated with the given key from the cache. It acquires a read lock to allow concurrent access from multiple goroutines. It returns the value and a boolean indicating if the value exists in the cache.
func (*DefaultCache[T]) Set ¶ added in v2.6.0
func (s *DefaultCache[T]) Set(key string, entries T)
Set adds or updates an entry in the cache with the specified key and value. It acquires an exclusive write lock to ensure exclusive access during the update.
Click to show internal directories.
Click to hide internal directories.