Documentation ¶
Index ¶
- Constants
- type CountMinSketch
- type Entry
- type Group
- type HashKey256
- type List
- func (l *List[K, V]) Back() *Entry[K, V]
- func (l *List[K, V]) Contains(entry *Entry[K, V]) bool
- func (l *List[K, V]) Front() *Entry[K, V]
- func (l *List[K, V]) Len() int
- func (l *List[K, V]) MoveAfter(e, mark *Entry[K, V])
- func (l *List[K, V]) MoveBefore(e, mark *Entry[K, V])
- func (l *List[K, V]) MoveToBack(e *Entry[K, V])
- func (l *List[K, V]) MoveToFront(e *Entry[K, V])
- func (l *List[K, V]) PopTail() *Entry[K, V]
- func (l *List[K, V]) PushBack(e *Entry[K, V]) *Entry[K, V]
- func (l *List[K, V]) PushFront(e *Entry[K, V]) *Entry[K, V]
- func (l *List[K, V]) Remove(e *Entry[K, V])
- func (l *List[K, V]) Reset()
- type MetaData
- type Metrics
- type Queue
- type ReadBufItem
- type RemoveReason
- type Result
- type Shard
- type Slru
- type Store
- func (s *Store[K, V]) Close()
- func (s *Store[K, V]) Delete(key K)
- func (s *Store[K, V]) EnsureOpen()
- func (s *Store[K, V]) Get(key K, epoch uint32) (V, bool)
- func (s *Store[K, V]) GetOrLoad(key K, epoch uint32, load func() (V, error)) (V, bool, error)
- func (s *Store[K, V]) Len() int
- func (s *Store[K, V]) MaxCapacity() int
- func (s *Store[K, V]) Range(epoch uint32, f func(key K, value V) bool)
- func (s *Store[K, V]) Set(key K, value V, cost int64, epoch uint32) bool
- func (s *Store[K, V]) UsedCapacity() int
- type StringKey
- type TinyLfu
- func (t *TinyLfu[K, V]) Access(item ReadBufItem[K, V])
- func (t *TinyLfu[K, V]) EvictEntries() []*Entry[K, V]
- func (t *TinyLfu[K, V]) Remove(entry *Entry[K, V])
- func (t *TinyLfu[K, V]) Set(entry *Entry[K, V]) *Entry[K, V]
- func (t *TinyLfu[K, V]) UpdateCost(entry *Entry[K, V], delta int64)
- func (t *TinyLfu[K, V]) UpdateThreshold()
- type WriteBufItem
Constants ¶
const ( NEW int8 = iota REMOVE UPDATE )
const ( LIST_PROBATION uint8 = 1 LIST_PROTECTED uint8 = 2 )
const ( MaxReadBuffSize = 64 MinWriteBuffSize = 4 MaxWriteBuffSize = 1024 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountMinSketch ¶
func NewCountMinSketch ¶
func NewCountMinSketch() *CountMinSketch
func (*CountMinSketch) Add ¶
func (s *CountMinSketch) Add(h uint64) bool
func (*CountMinSketch) EnsureCapacity ¶
func (s *CountMinSketch) EnsureCapacity(size uint)
func (*CountMinSketch) Estimate ¶
func (s *CountMinSketch) Estimate(h uint64) uint
type Group ¶
type Group[K comparable, V any] struct { // contains filtered or unexported fields }
Group represents a class of work and forms a namespace in which units of work can be executed with duplicate suppression.
func NewGroup ¶
func NewGroup[K comparable, V any]() *Group[K, V]
func (*Group[K, V]) Do ¶
Do executes and returns the results of the given function, making sure that only one execution is in-flight for a given key at a time. If a duplicate comes in, the duplicate caller waits for the original to complete and receives the same results. The return value shared indicates whether v was given to multiple callers.
type HashKey256 ¶
type HashKey256 [32]byte
func (HashKey256) Hash ¶
func (h HashKey256) Hash() uint64
func (HashKey256) Hash2 ¶
func (h HashKey256) Hash2() (uint64, uint64)
type List ¶
type List[K cachekey, V any] struct { // contains filtered or unexported fields }
List represents a doubly linked list. The zero value for List is an empty list ready to use.
func (*List[K, V]) MoveAfter ¶
MoveAfter moves element e to its new position after mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.
func (*List[K, V]) MoveBefore ¶
MoveBefore moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.
func (*List[K, V]) MoveToBack ¶
MoveToBack moves element e to the back of list l. If e is not an element of l, the list is not modified. The element must not be nil.
func (*List[K, V]) MoveToFront ¶
MoveToFront moves element e to the front of list l. If e is not an element of l, the list is not modified. The element must not be nil.
type MetaData ¶
type MetaData[K cachekey, V any] struct { // contains filtered or unexported fields }
type Queue ¶
type Queue[V any] struct { // contains filtered or unexported fields }
func (*Queue[V]) Empty ¶
Empty returns true if the queue is empty
Empty must be called from a single, consumer goroutine
type ReadBufItem ¶
type ReadBufItem[K cachekey, V any] struct { // contains filtered or unexported fields }
type Result ¶
type Result struct { Val interface{} Err error }
Result holds the results of Do, so they can be passed on a channel.
type Store ¶
type Store[K cachekey, V cacheval] struct { Metrics Metrics OnRemoval func(K, V, RemoveReason) // contains filtered or unexported fields }
func (*Store[K, V]) EnsureOpen ¶
func (s *Store[K, V]) EnsureOpen()
func (*Store[K, V]) MaxCapacity ¶
func (*Store[K, V]) UsedCapacity ¶
type TinyLfu ¶
type TinyLfu[K cachekey, V any] struct { // contains filtered or unexported fields }
func NewTinyLfu ¶
func (*TinyLfu[K, V]) Access ¶
func (t *TinyLfu[K, V]) Access(item ReadBufItem[K, V])
func (*TinyLfu[K, V]) EvictEntries ¶
func (*TinyLfu[K, V]) UpdateCost ¶
func (*TinyLfu[K, V]) UpdateThreshold ¶
func (t *TinyLfu[K, V]) UpdateThreshold()
type WriteBufItem ¶
type WriteBufItem[K cachekey, V any] struct { // contains filtered or unexported fields }