package
Version:
v0.2.0
Opens a new window with list of versions in this module.
Published: Apr 17, 2026
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
LRU is a generic, thread-safe least-recently-used cache.
func (c *LRU[K, V]) Clear()
Clear removes all items.
func (c *LRU[K, V]) Delete(key K)
Delete removes a key from the cache.
func (c *LRU[K, V]) Get(key K) (V, bool)
Get retrieves a value and moves it to the front (most recent).
Len returns the current number of items.
func (c *LRU[K, V]) Put(key K, val V)
Put inserts or updates a key-value pair. Evicts LRU if at capacity.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.