Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache holds a map of volatile key -> values.
func NewCache ¶
func NewCache() *Cache
NewCache initializes a new caching space with default settings.
func NewCacheWithCapacity ¶
NewCacheWithCapacity initializes a new caching space with the given capacity.
func (*Cache) Clear ¶
func (c *Cache) Clear()
Clear generates a new memory space, leaving the old memory unreferenced, so it can be claimed by the garbage collector.
func (*Cache) Read ¶
Read attempts to retrieve a cached value as a string, if the value does not exists returns an empty string and false.
type HasOnEvict ¶ added in v4.6.0
type HasOnEvict interface {
OnEvict()
}
HasOnEvict type is (optionally) implemented by cache objects to clean after themselves.
Click to show internal directories.
Click to hide internal directories.