Documentation ¶
Index ¶
- type Cache
- func (cache *Cache) Count() int
- func (cache *Cache) Delete(key interface{}) bool
- func (cache *Cache) Get(key interface{}) (interface{}, bool)
- func (cache *Cache) Keys() []interface{}
- func (cache *Cache) Range(f func(key, value interface{}) error)
- func (cache *Cache) Reset()
- func (cache *Cache) Set(key, data interface{})
- type Item
- type Option
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) Get ¶
Get is a thread-safe way to lookup items Every lookup, also add the timeout of the item, hence extending it's life
func (*Cache) Keys ¶ added in v0.1.9
func (cache *Cache) Keys() []interface{}
AllKeys returns all keys store in the cache
Click to show internal directories.
Click to hide internal directories.