Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidDuration = errors.New("expireAfter duration cannot be negative")
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T any] struct { // contains filtered or unexported fields }
func (*Cache[T]) Clear ¶
func (c *Cache[T]) Clear()
Clear removes all items from the cache, regardless of their expiration.
func (*Cache[T]) Lookup ¶
Lookup checks the cache for a non-expired object by the supplied key name. The bool return informs the caller if there was a cache hit or not. A return of nil, true means that nil is in the cache. Where nil, false indicates a cache miss or that the value is expired and should be refreshed.
func (*Cache[T]) Set ¶
Set saves the current value of an object in the cache, with the supplied durintion until the object expires.
Click to show internal directories.
Click to hide internal directories.