Documentation ¶
Index ¶
- type Block
- type Cache
- func (c *Cache) GetBlock(k Key) Block
- func (c *Cache) Len() int
- func (c *Cache) Misses() uint64
- func (c *Cache) MustStop()
- func (c *Cache) PutBlock(k Key, b Block)
- func (c *Cache) RemoveBlocksForPart(p interface{})
- func (c *Cache) Requests() uint64
- func (c *Cache) SizeBytes() int
- func (c *Cache) SizeMaxBytes() int
- type Key
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block interface { // SizeBytes must return the approximate size of the given block in bytes SizeBytes() int }
Block is an item, which may be cached in the Cache.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache caches Block entries.
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) RemoveBlocksForPart ¶
func (c *Cache) RemoveBlocksForPart(p interface{})
RemoveBlocksForPart removes all the blocks for the given part from the cache.
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.
Click to show internal directories.
Click to hide internal directories.