Documentation ¶
Overview ¶
The implementation borrows heavily from SmallLRUCache (originally by Nathan Schrenk). The object maintains a doubly-linked list of elements in the When an element is accessed it is promoted to the head of the list, and when space is needed the element at the tail of the list (the least recently used element) is evicted.
Index ¶
- type Item
- type LRUCache
- func (lru *LRUCache) Clear()
- func (lru *LRUCache) Delete(key string) bool
- func (lru *LRUCache) Get(key string) (v Value, ok bool)
- func (lru *LRUCache) Items() []Item
- func (lru *LRUCache) Keys() []string
- func (lru *LRUCache) Set(key string, value Value)
- func (lru *LRUCache) SetCapacity(capacity uint64)
- func (lru *LRUCache) SetIfAbsent(key string, value Value)
- func (lru *LRUCache) Stats() (length, size, capacity uint64, oldest time.Time)
- func (lru *LRUCache) StatsJSON() string
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
func NewLRUCache ¶
func (*LRUCache) SetCapacity ¶
func (*LRUCache) SetIfAbsent ¶
Click to show internal directories.
Click to hide internal directories.