Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TimeoutCache ¶
type TimeoutCache[V any] struct { // contains filtered or unexported fields }
TimeoutCache provides a cache with timeout.
func (*TimeoutCache[V]) Get ¶
func (m *TimeoutCache[V]) Get() (value V, ok bool)
Get returns the cached value if set and it hasn't timed out and returns true. If it has timed out, it will return V's zero value and false, and will need to be set again.
func (*TimeoutCache[V]) Set ¶
func (m *TimeoutCache[V]) Set(value V)
Set remembers the value and resets the invalid time based on when the cache was set.
Click to show internal directories.
Click to hide internal directories.