Documentation
¶
Index ¶
- type ARCCache
- func (c *ARCCache[K, V]) Add(key K, value V)
- func (c *ARCCache[K, V]) Contains(key K) bool
- func (c *ARCCache[K, V]) Get(key K) (value V, ok bool)
- func (c *ARCCache[K, V]) Keys() []K
- func (c *ARCCache[K, V]) Len() int
- func (c *ARCCache[K, V]) Peek(key K) (value V, ok bool)
- func (c *ARCCache[K, V]) Purge()
- func (c *ARCCache[K, V]) Remove(key K)
- func (c *ARCCache[K, V]) Values() []V
- type Entry
- type EvictCallback
- type LRU
- func (c *LRU[K, V]) Add(key K, value V) (evicted bool)
- func (c *LRU[K, V]) Contains(key K) (ok bool)
- func (c *LRU[K, V]) Get(key K) (value V, ok bool)
- func (c *LRU[K, V]) GetOldest() (key K, value V, ok bool)
- func (c *LRU[K, V]) Keys() []K
- func (c *LRU[K, V]) Len() int
- func (c *LRU[K, V]) Peek(key K) (value V, ok bool)
- func (c *LRU[K, V]) Purge()
- func (c *LRU[K, V]) Remove(key K) bool
- func (c *LRU[K, V]) RemoveOldest() (key K, value V, ok bool)
- func (c *LRU[K, V]) Resize(size int) (evicted int)
- func (c *LRU[K, V]) Values() []V
- type List
- func (l *List[K, V]) Back() *Entry[K, V]
- func (l *List[K, V]) Init() *List[K, V]
- func (l *List[K, V]) Length() int
- func (l *List[K, V]) MoveToFront(e *Entry[K, V])
- func (l *List[K, V]) PushFront(k K, v V) *Entry[K, V]
- func (l *List[K, V]) PushFrontExpirable(k K, v V, expiresAt time.Time) *Entry[K, V]
- func (l *List[K, V]) Remove(e *Entry[K, V]) V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARCCache ¶
type ARCCache[K comparable, V any] struct { // contains filtered or unexported fields }
type Entry ¶
type Entry[K comparable, V any] struct { Key K Value V ExpiresAt time.Time ExpireBucket uint8 // contains filtered or unexported fields }
type EvictCallback ¶
type EvictCallback[K comparable, V any] func(key K, value V)
type LRU ¶
type LRU[K comparable, V any] struct { // contains filtered or unexported fields }
func New ¶
func New[K comparable, V any](size int, onEvict EvictCallback[K, V]) *LRU[K, V]
func NewWithExpire ¶
func NewWithExpire[K comparable, V any](size int, ttl time.Duration, onEvict EvictCallback[K, V]) *LRU[K, V]
func (*LRU[K, V]) RemoveOldest ¶
type List ¶
type List[K comparable, V any] struct { // contains filtered or unexported fields }
func NewList ¶
func NewList[K comparable, V any]() *List[K, V]
func (*List[K, V]) MoveToFront ¶
func (*List[K, V]) PushFrontExpirable ¶
Click to show internal directories.
Click to hide internal directories.