Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Default2QRecentRatio is the ratio of the 2Q cache dedicated // to recently added entries that have only been accessed once. Default2QRecentRatio = 0.20 // Default2QGhostEntries is the default ratio of ghost // entries kept to track entries recently evicted Default2QGhostEntries = 0.80 )
View Source
const (
ErrNotFoundInCache = "not found in cache"
)
Variables ¶
This section is empty.
Functions ¶
func NewTwoQueue ¶
NewTwoQueue creates a new twoQueueCache using the default values for the parameters.
func NewTwoQueueParams ¶
NewTwoQueueParams creates a new twoQueueCache using the provided parameter values.
Types ¶
type Key ¶
type Key interface{}
Key is any value which is comparable. See http://golang.org/ref/spec#Comparison_operators for details.
type LRUCache ¶
type LRUCache interface { Get(key interface{}) (value Value, err error) Put(key, value interface{}) (err error) Contains(key interface{}) (ok bool) Peek(key interface{}) (value interface{}, err error) Remove(key interface{}) (ok bool) Len() int RemoveOldest() (err error) Keys() []interface{} Purge() }
Click to show internal directories.
Click to hide internal directories.