package lru // LRU is the interface for simple LRU cache. type LRU interface { // Add Adds a value to the cache, returns true if an eviction occurred and // updates the "recently used"-ness of the key. Add(key, value any) bool // Get Returns key's value from the cache and // updates the "recently used"-ness of the key. #value, isFound Get(key any) (value any, ok bool) // Contains Checks if a key exists in cache without updating the recent-ness. Contains(key any) (ok bool) // Peek Returns key's value without updating the "recently used"-ness of the key. Peek(key any) (value any, ok bool) // Remove Removes a key from the cache. Remove(key any) bool // RemoveOldest Removes the oldest entry from cache. RemoveOldest() (any, any, bool) // GetOldest Returns the oldest entry from the cache. #key, value, isFound GetOldest() (any, any, bool) // Keys Returns a slice of the keys in the cache, from oldest to newest. Keys() []any // Values Returns a slice of the values in the cache, from oldest to newest. Values() []any // Len Returns the number of items in the cache. Len() int // Purge Clears all cache entries. Purge() // Resize Resizes cache, returning number evicted Resize(int) int }