Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expiration ¶
type Expiration[K comparable, V any] struct { // contains filtered or unexported fields }
func NewExpiration ¶
func NewExpiration[K comparable, V any](capacity int, timeout time.Duration, interval time.Duration, onEvict func(key K, value V)) *Expiration[K, V]
func (*Expiration[K, V]) Delete ¶
func (c *Expiration[K, V]) Delete(key K)
func (*Expiration[K, V]) Dispose ¶
func (c *Expiration[K, V]) Dispose()
func (*Expiration[K, V]) Extend ¶
func (c *Expiration[K, V]) Extend(key K)
func (*Expiration[K, V]) Get ¶
func (c *Expiration[K, V]) Get(key K, callback func() (V, error)) (V, error)
func (*Expiration[K, V]) GetIfPresent ¶
func (c *Expiration[K, V]) GetIfPresent(key K) (V, bool)
func (*Expiration[K, V]) Put ¶
func (c *Expiration[K, V]) Put(key K, value V)
type LRU ¶
type LRU[K comparable, V any] struct { // contains filtered or unexported fields }
LRU represents a Least Recently Used cache
Head -> Node -> <-prev- Node(value) -next-> <- Node <-Tail
func NewLRU ¶
func NewLRU[K comparable, V any](capacity int, onEvict func(key K, value V)) *LRU[K, V]
func (*LRU[K, V]) ReverseIterator ¶
type NodeKV ¶
type NodeKV[K comparable, V any] struct { // contains filtered or unexported fields }
NodeKV represents a node in the doubly linked list
Click to show internal directories.
Click to hide internal directories.