Documentation ¶
Overview ¶
Package lrucache contains a simple LRU cache, designed to wrap a function.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { ResponsesList *list.List ResponsesLookup map[uint64]*list.Element sync.Mutex // contains filtered or unexported fields }
Cache represents an instance of an LRU cache.
func (*Cache) Call ¶
Call checks the lookup table to see if there is already a cached response for this input. If there already is, move the cache entry to the front of the list. If not, check if our cache is full. If full, delete the least recently used entry (at the end of the list) and insert the new one in the front.
type CachedFunc ¶
CachedFunc represents a function that we want to cache the responses from.
Click to show internal directories.
Click to hide internal directories.