Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LRUCache ¶
type LRUCache[K comparable, V any] struct { // contains filtered or unexported fields }
LRUCache lru cache (thread safe)
func NewLRUCache ¶
func NewLRUCache[K comparable, V any](capacity int) *LRUCache[K, V]
NewLRUCache creates a LRUCache pointer instance.
func (*LRUCache[K, V]) Clear ¶ added in v0.0.6
func (l *LRUCache[K, V]) Clear()
Clear removes all items from the cache.
func (*LRUCache[K, V]) Foreach ¶ added in v0.1.2
func (l *LRUCache[K, V]) Foreach(cb func(value V))
Foreach applies a modification function to each value in the cache.
type LinkNode ¶
LinkNode is a linkedlist node, which have a Value and Pre points to previous node, Next points to a next node of the link.
func NewLinkNode ¶
NewLinkNode return a LinkNode pointer
type QueueNode ¶
QueueNode is a node in a queue, which have a Value and Next pointer points to next node in the queue.
func NewQueueNode ¶
NewQueueNode return a QueueNode pointer
type StackNode ¶
StackNode is a node in stack, which have a Value and Next pointer points to next node in the stack.
func NewStackNode ¶
NewStackNode return a StackNode pointer
Click to show internal directories.
Click to hide internal directories.