Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Adds node to cache. If full and had to remove the oldest element,
// returns the oldest, otherwise nil.
// CONTRACT: node can never be nil. Otherwise, cache panics.
Add(node Node) Node
// Returns Node for the key, if exists. nil otherwise.
Get(key []byte) Node
// Has returns true if node with key exists in cache, false otherwise.
Has(key []byte) bool
// Remove removes node with key from cache. The removed node is returned.
// if not in cache, return nil.
Remove(key []byte) Node
// Len returns the cache length.
Len() int
}
Cache is an in-memory structure to persist nodes for quick access. Please see lruCache for more details about why we need a custom cache implementation.
Click to show internal directories.
Click to hide internal directories.