Documentation ¶
Index ¶
- type LRUCache
- func (cache *LRUCache) ComputeIfAbsent(key interface{}, callback func() interface{}) (result interface{})
- func (cache *LRUCache) ComputeIfPresent(key interface{}, callback func(value interface{}) interface{}) interface{}
- func (cache *LRUCache) Contains(key interface{}) (result bool)
- func (cache *LRUCache) Delete(key interface{}) bool
- func (cache *LRUCache) DeleteAll()
- func (cache *LRUCache) DeleteWithoutEviction(key interface{}) (existed bool, keyToEvict interface{}, valueToEvict interface{})
- func (cache *LRUCache) Get(key interface{}) (result interface{})
- func (cache *LRUCache) GetCapacity() int
- func (cache *LRUCache) GetSize() int
- func (cache *LRUCache) Set(key interface{}, value interface{})
- type Options
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) ComputeIfAbsent ¶
func (cache *LRUCache) ComputeIfAbsent(key interface{}, callback func() interface{}) (result interface{})
func (*LRUCache) ComputeIfPresent ¶
func (cache *LRUCache) ComputeIfPresent(key interface{}, callback func(value interface{}) interface{}) interface{}
Calls the callback if an entry with the given key exists. The result of the callback is written back into the cache. If the callback returns nil the entry is removed from the cache. Returns the updated entry.
func (*LRUCache) DeleteWithoutEviction ¶
func (*LRUCache) GetCapacity ¶
Click to show internal directories.
Click to hide internal directories.