Documentation ¶
Index ¶
Constants ¶
View Source
const CHKSIZE uint32 = 1 << 22
View Source
const IOV_MAX uint32 = CHKSIZE / MAX_IO_SIZE
View Source
const MAX_IO_SIZE uint32 = 4096
View Source
const MaxMsgSize uint32 = CHKSIZE + 4096
View Source
const OBJSIZE uint32 = CHKSIZE
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { // MaxEntries is the maximum number of cache entries before // an item is evicted. Zero means no limit. MaxEntries int // OnEvicted optionally specifies a callback function to be // executed when an entry is purged from the cache. OnEvicted func(key Key, value interface{}) // contains filtered or unexported fields }
Cache is an LRU cache. It is not safe for concurrent access.
func NewCache ¶
New creates a new Cache. If maxEntries is zero, the cache has no limit and it's assumed that eviction is done by the caller.
func (*Cache) RemoveOldest ¶
func (c *Cache) RemoveOldest()
RemoveOldest removes the oldest item from the cache.
type Key ¶
type Key interface{}
A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators
Click to show internal directories.
Click to hide internal directories.