Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
Cache defines the methods LoadWithUpdate and Store, the user needs to define the function `update`.
func New ¶
New returns the *Cache. the function update, if found new *Item, returns true, and stores it; else returns false, and delete the key from cache.
func (*Cache) LoadWithUpdate ¶
LoadWithUpdate loads the cached item. if the item is not cached, it returns the newest and cache the new item. if the item is expired, it returns the cached item and try to cache the newest. if the item is not expired, it returns it and do nothing.
Click to show internal directories.
Click to hide internal directories.