Documentation
¶
Index ¶
- type LRUCache
- func (c *LRUCache[K, V]) Algorithm() string
- func (c *LRUCache[K, V]) Capacity() int
- func (c *LRUCache[K, V]) Delete(key K) bool
- func (c *LRUCache[K, V]) DeleteMany(keys []K) map[K]bool
- func (c *LRUCache[K, V]) DeleteOldest() (k K, v V, ok bool)
- func (c *LRUCache[K, V]) Get(key K) (value V, ok bool)
- func (c *LRUCache[K, V]) GetMany(keys []K) (map[K]V, []K)
- func (c *LRUCache[K, V]) Has(key K) bool
- func (c *LRUCache[K, V]) HasMany(keys []K) map[K]bool
- func (c *LRUCache[K, V]) Keys() []K
- func (c *LRUCache[K, V]) Len() int
- func (c *LRUCache[K, V]) Peek(key K) (value V, ok bool)
- func (c *LRUCache[K, V]) PeekMany(keys []K) (map[K]V, []K)
- func (c *LRUCache[K, V]) Purge()
- func (c *LRUCache[K, V]) Range(f func(K, V) bool)
- func (c *LRUCache[K, V]) Set(key K, value V)
- func (c *LRUCache[K, V]) SetMany(items map[K]V)
- func (c *LRUCache[K, V]) Values() []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LRUCache ¶
type LRUCache[K comparable, V any] struct { // contains filtered or unexported fields }
Cache is an LRU cache. It is not safe for concurrent access.
func NewLRUCache ¶
func NewLRUCache[K comparable, V any](capacity int) *LRUCache[K, V]
func (*LRUCache[K, V]) DeleteMany ¶
implements base.InMemoryCache
func (*LRUCache[K, V]) DeleteOldest ¶
func (*LRUCache[K, V]) GetMany ¶
func (c *LRUCache[K, V]) GetMany(keys []K) (map[K]V, []K)
implements base.InMemoryCache
func (*LRUCache[K, V]) PeekMany ¶
func (c *LRUCache[K, V]) PeekMany(keys []K) (map[K]V, []K)
implements base.InMemoryCache
func (*LRUCache[K, V]) Set ¶
func (c *LRUCache[K, V]) Set(key K, value V)
implements base.InMemoryCache
Click to show internal directories.
Click to hide internal directories.