Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Impl ¶
type Impl[K comparable, V any] struct { // contains filtered or unexported fields }
Impl is a lazy key->value map. It's a wrapper around a map and a mutex. If values exceed their time-to-live, they are pruned at Get time.
func New ¶
func New[K comparable, V any]() *Impl[K, V]
New creates a new DecayMap of key type K and value type V.
Key types must be comparable to work with maps.
func (*Impl[K, V]) Cleanup ¶
func (m *Impl[K, V]) Cleanup()
Cleanup removes all expired entries from the DecayMap.
func (*Impl[K, V]) Get ¶
Get gets a value from the DecayMap by key.
If a value has expired, forcibly delete it if it was not updated.
Click to show internal directories.
Click to hide internal directories.