Documentation
¶
Index ¶
- type Cache
- func (c *Cache) GetEntry(k string) Entry
- func (c *Cache) Len() int
- func (c *Cache) Misses() uint64
- func (c *Cache) MustStop()
- func (c *Cache) PutEntry(k string, e Entry)
- func (c *Cache) Requests() uint64
- func (c *Cache) Reset()
- func (c *Cache) Resets() uint64
- func (c *Cache) SizeBytes() uint64
- func (c *Cache) SizeMaxBytes() uint64
- type Entry
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 caches Entry entries.
If the cache is full the least recently used entries are evicted to make room for new entries. Additionally, entries are evicted if not retrieved within the last three minutes.
The cache should be used only if the rate of requests is in the range of thousands. I.e. it is suitable for use in data retrieval paths and should not be used in data ingestion path since its qps is often in the range of millions.
Call NewCache() for creating new Cache.
func NewCache ¶
NewCache creates new cache.
Cache size in bytes is limited by the value returned by getMaxSizeBytes() callback. Call MustStop() in order to free up resources occupied by Cache.
func (*Cache) Misses ¶
Misses returns the number of cache misses for c since cache creation or last reset.
func (*Cache) Requests ¶
Requests returns the number of requests served by c since cache creation or last reset.
func (*Cache) Resets ¶ added in v1.110.25
Resets returns the number of cache resets since its creation.
func (*Cache) SizeBytes ¶
SizeBytes returns an approximate size in bytes of all the blocks stored in the cache c.
func (*Cache) SizeMaxBytes ¶
SizeMaxBytes returns the max allowed size in bytes for c.