Documentation
¶
Overview ¶
Package lru
(C) Copyright Alex Gaetano Padula
Licensed under the Mozilla Public License, v. 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.mozilla.org/en-US/MPL/2.0/
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type EvictionCallback
- type LRU
- func (list *LRU) Clear()
- func (list *LRU) Delete(key interface{}) bool
- func (list *LRU) ForEach(fn func(key, value interface{}, accessCount uint64) bool)
- func (list *LRU) ForceEvictionProcessing()
- func (list *LRU) Get(key interface{}) (interface{}, bool)
- func (list *LRU) Length() int64
- func (list *LRU) Put(key, value interface{}, onEvict ...EvictionCallback) bool
- type Node
- type ValueWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EvictionCallback ¶ added in v0.3.0
type EvictionCallback func(key, value interface{})
type LRU ¶
type LRU struct {
// contains filtered or unexported fields
}
LRU is a lockless linked list with lazy eviction and anti-thrashing mechanisms
func (*LRU) ForceEvictionProcessing ¶ added in v0.3.2
func (list *LRU) ForceEvictionProcessing()
ForceEvictionProcessing forces the processing of the eviction queue ***************This is mainly for testing purposes to ensure eviction happens immediately
func (*LRU) Put ¶
func (list *LRU) Put(key, value interface{}, onEvict ...EvictionCallback) bool
Put adds or updates a key-value pair with anti-thrashing mechanisms
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a node in the linked list
type ValueWrapper ¶ added in v0.3.0
type ValueWrapper struct {
// contains filtered or unexported fields
}
ValueWrapper is a wrapper for values stored in the LRU list