Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Discards the least recently used items first. LRU evictionPolicy = iota // Discards the least frequently used items first. LFU // Adaptive replacement cache policy. ARC // Noop cache without replacement policy. NOOP )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
Cache is cache with TTL and eviction over capacity.
func (*Cache[K, V]) Remove ¶ added in v0.1.6
func (c *Cache[K, V]) Remove(key K)
Remove removes cache entry by given key.
type Option ¶ added in v1.0.0
type Option func(*config)
Option is an option that can be applied to cache.
func WithEvictionPolicy ¶ added in v1.0.0
func WithEvictionPolicy(policy evictionPolicy) Option
WithEvictionPolicy sets eviction policy for cache.
func WithTTLEpochGranularity ¶ added in v1.0.0
WithTTLEpochGranularity sets ttl epoch granularity.
Click to show internal directories.
Click to hide internal directories.