Documentation
¶
Overview ¶
Package lru provides a fixed size LRU cache
- O(1) Add, Get, Contains and Remove - Generic implementation for better type-safety - Thread-safe operations via mutexes
LRU is implemented via a generic doubly linked list, available in package "github.com/binjamil/go-lru/list"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LRU ¶
type LRU[K comparable, V any] struct { // contains filtered or unexported fields }
LRU is a thread-safe fixed size LRU cache.
func New ¶
func New[K comparable, V any](capacity uint) (*LRU[K, V], error)
New creates an LRU cache with the given capacity.
func (*LRU[K, V]) Contains ¶
Contains checks if the specified key is present in the LRU without updating the "recently used"-ness of the key.
Click to show internal directories.
Click to hide internal directories.