Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a synchronised map of items that auto-expire once stale
func NewCache ¶
NewCache creates a instance of the Cache struct. Argument duration stands for the existing time of item in the cache. When no argument is passed, the item will persistently existed in the cache.
func (*Cache) Count ¶
Count returns the number of items in the cache (helpful for tracking memory leaks)
func (*Cache) Get ¶
Get is a thread-safe way to lookup items Every lookup, also add the timeout of the item, hence extending it's life
Click to show internal directories.
Click to hide internal directories.