decaymap

package
v3.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: CC-BY-4.0, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecayMap

type DecayMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

DecayMap is a coarse-grained paired map that bulk-frees outdated entries.

func NewDecayMap

func NewDecayMap[K comparable, V any](epoch time.Time, period time.Duration) *DecayMap[K, V]

func (*DecayMap[K, V]) Pop

func (m *DecayMap[K, V]) Pop(key K) (V, bool)

Attempts to retrieve and remove a value from the store, does not guarantee the value is unexpired.

func (*DecayMap[K, V]) Set

func (m *DecayMap[K, V]) Set(now time.Time, key K, value V)

Sets a value in the store, overwriting the existing value if exists.

Inserting values in non monotonic order is a no op.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL