Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TTLCache ¶
type TTLCache[K comparable, V any] struct { // contains filtered or unexported fields }
TTLCache is a generic cache implementation with support for time-to-live (TTL) expiration.
func NewTTL ¶
func NewTTL[K comparable, V any]() *TTLCache[K, V]
NewTTL creates a new TTLCache instance and starts a goroutine to periodically remove expired items every 5 seconds.
func (*TTLCache[K, V]) Pop ¶
Pop removes and returns the item with the specified key from the cache.
func (*TTLCache[K, V]) Remove ¶
func (c *TTLCache[K, V]) Remove(key K)
Remove removes the item with the specified key from the cache.
Click to show internal directories.
Click to hide internal directories.