Documentation ¶
Index ¶
- type EvictCallback
- type EvictionReason
- type FIFO
- func (f *FIFO) Add(key uuid.UUID, value models.Record) bool
- func (f *FIFO) Contains(key uuid.UUID) bool
- func (f *FIFO) Dequeue(fn func(uuid.UUID, models.Record) error) ([]KeyValue, error)
- func (f *FIFO) Get(key uuid.UUID) (models.Record, bool)
- func (f *FIFO) Keys() []uuid.UUID
- func (f *FIFO) Len() int
- func (f *FIFO) Pop() (uuid.UUID, models.Record, bool)
- func (f *FIFO) Purge()
- func (f *FIFO) Remove(key uuid.UUID) bool
- func (f *FIFO) Slice() []KeyValue
- type KeyValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EvictCallback ¶
type EvictCallback func(EvictionReason, uuid.UUID, models.Record)
EvictCallback lets you know when an eviction has happened in the cache
type EvictionReason ¶
type EvictionReason int
EvictionReason describes why the eviction happened
const ( // Purged by calling reset Purged EvictionReason = iota // Popped manually from the cache Popped // Removed manually from the cache Removed // Dequeued by walking over due to being dequeued Dequeued )
type FIFO ¶
type FIFO struct {
// contains filtered or unexported fields
}
func NewFIFO ¶
func NewFIFO(onEvict EvictCallback) *FIFO
NewFIFO implements a non-thread safe FIFO cache
func (*FIFO) Purge ¶
func (f *FIFO) Purge()
Purge removes all items with in the cache, calling evict callback on each.
Click to show internal directories.
Click to hide internal directories.