Type Parameters:
K: comparable
V: any Entry is an LRU Entry The expiry bucket item was put in, optional The time this element would be cleaned up, optional The LRU Key of this element. The Value stored with this element. PrevEntry returns the previous list element or nil.
func (*Entry)[K, V].PrevEntry() *Entry[K, V]
func (*LruList)[K, V].Back() *Entry[K, V]
func (*LruList)[K, V].PushFront(k K, v V) *Entry[K, V]
func (*LruList)[K, V].PushFrontExpirable(k K, v V, expiresAt time.Time) *Entry[K, V]
func (*LruList)[K, V].MoveToFront(e *Entry[K, V])
func (*LruList)[K, V].Remove(e *Entry[K, V]) V
Type Parameters:
K: comparable
V: any LruList represents a doubly linked list.
The zero Value for LruList is an empty list ready to use. Back returns the last element of list l or nil if the list is empty. Init initializes or clears list l. Length returns the number of elements of list l.
The complexity is O(1). MoveToFront moves element e to the front of list l.
If e is not an element of l, the list is not modified.
The element must not be nil. PushFront inserts a new element e with value v at the front of list l and returns e. PushFrontExpirable inserts a new expirable element e with Value v at the front of list l and returns e. Remove removes e from its list, decrements l.len
func NewList[K, V]() *LruList[K, V]
func (*LruList)[K, V].Init() *LruList[K, V]
Package-Level Functions (only one)
Type Parameters:
K: comparable
V: any NewList returns an initialized list.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.