Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
NumCached metrics.Meter
NumTotal metrics.Meter
NumLoad metrics.Meter
NumLoadedBytes metrics.Meter
// contains filtered or unexported fields
}
Cache is a LRU piece cache of certain size. Items in the cache are expired after the defined TTL.
func (*Cache) Close ¶ added in v0.3.0
func (c *Cache) Close()
Close the cache and release all resources.
func (*Cache) Get ¶
Get item with the key from cache. If item is not in cache, load by calling `loader` func and put into the cache.
func (*Cache) Len ¶ added in v0.3.0
Len returns the number of items in the cache. Items may be in different sizes.
func (*Cache) LoadsActive ¶ added in v0.5.5
LoadsActive returns the number of active Loader calls.
func (*Cache) LoadsWaiting ¶ added in v0.5.2
LoadsWaiting returns the number of waiting Loader calls.
func (*Cache) Utilization ¶ added in v0.3.0
Utilization is a number between 0 and 100 that returns the hit-ratio of the cache.
Click to show internal directories.
Click to hide internal directories.