Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultMaxItems = 1_000 DefaultTTL = 10 * time.Minute DefaultJanitorInterval = 1 * time.Minute DefaultCompactThreshold = 1_000 )
Functions ¶
Types ¶
type Config ¶
type Config struct {
MaxItems int `cfg:"max_items" json:"max_items"`
TTL time.Duration `cfg:"ttl" json:"ttl"`
JanitorInterval time.Duration `cfg:"janitor_interval" json:"janitor_interval"`
// CompactThreshold is the minimum peak item count before map compaction
// is considered. When the map shrinks to ≤25% of its peak size and the
// peak exceeded this threshold, the map is rebuilt to release memory.
// Default is 1000.
CompactThreshold int `cfg:"compact_threshold" json:"compact_threshold"`
}
type Memory ¶
type Memory[K comparable, V any] struct { // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.