Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable] struct { // contains filtered or unexported fields }
Cache is a set of unique keys of type K.
Cache implements epoch-based expiry. Each PERIOD current keys are marked as stale and stale keys are discarded. This means that effective per-key expiry time is in between PERIOD and 2*PERIOD.
func (*Cache[K]) GetAll ¶ added in v0.23.0
func (c *Cache[K]) GetAll() []K
GetAll returns a copy of current state of cache.
State is returned as a list in an arbitrary order.
func (*Cache[K]) NewEpochForTest ¶ added in v0.25.2
func (c *Cache[K]) NewEpochForTest()
NewEpochForTest triggers manual epoch rotation.
Should be used only in tests.
Click to show internal directories.
Click to hide internal directories.