Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EvictCallback ¶
EvictCallback is the type of callbacks that are invoked when items are evicted.
type SizedLRU ¶
type SizedLRU interface {
Add(key Key, value SizedItem) (ok bool)
Get(key Key) (value SizedItem, ok bool)
Remove(key Key)
Len() int
CurrentSize() int64
MaxSize() int64
}
SizedLRU is an LRU cache that will keep its total size below maxSize by evicting items. SizedLRU is not thread-safe.
func NewSizedLRU ¶
func NewSizedLRU(maxSize int64, onEvict EvictCallback) SizedLRU
NewSizedLRU returns a new sizedLRU cache
Click to show internal directories.
Click to hide internal directories.