Versions in this module Expand all Collapse all v0 v0.1.0 Jun 15, 2023 Changes in this version + var DefaultCacheType = LRUCache + type Cache interface + Elems func() []*Item + Get func(key uint64) (interface{}, bool) + Len func() int + Peek func(key uint64) (interface{}, bool) + Put func(key uint64, value interface{}) + Remove func(key uint64) + func NewCache(size int, cacheType Type) Cache + func NewDefaultCache(size int) Cache + type Entry struct + Priority int + Value PriorityQueueItem + func (r *Entry) Less(other *Entry) bool + type FIFO struct + func NewFIFO(maxCount int) *FIFO + func (c *FIFO) Elems() []*Item + func (c *FIFO) FromElems(key uint64) []*Item + func (c *FIFO) FromLastSameElems(checkFunc func(interface{}) (bool, string)) []*Item + func (c *FIFO) Len() int + func (c *FIFO) Put(key uint64, value interface{}) + func (c *FIFO) Remove() + type Item struct + Key uint64 + Value interface{} + type LRU struct + func (c *LRU) Elems() []*Item + func (c *LRU) Get(key uint64) (interface{}, bool) + func (c *LRU) Len() int + func (c *LRU) Peek(key uint64) (interface{}, bool) + func (c *LRU) Put(key uint64, value interface{}) + func (c *LRU) Remove(key uint64) + type PriorityQueue struct + func NewPriorityQueue(capacity int) *PriorityQueue + func (pq *PriorityQueue) Elems() []*Entry + func (pq *PriorityQueue) Get(id uint64) *Entry + func (pq *PriorityQueue) Len() int + func (pq *PriorityQueue) Peek() *Entry + func (pq *PriorityQueue) Put(priority int, value PriorityQueueItem) bool + func (pq *PriorityQueue) Remove(id uint64) + func (pq *PriorityQueue) Tail() *Entry + type PriorityQueueItem interface + ID func() uint64 + type TTLString struct + func NewStringTTL(ctx context.Context, gcInterval, ttl time.Duration) *TTLString + func (c *TTLString) Get(id string) (interface{}, bool) + func (c *TTLString) GetAllID() []string + func (c *TTLString) Pop() (string, interface{}, bool) + func (c *TTLString) Put(key string, value interface{}) + func (c *TTLString) PutWithTTL(key string, value interface{}, ttl time.Duration) + func (c TTLString) Clear() + func (c TTLString) Len() int + func (c TTLString) UpdateTTL(duration time.Duration) + type TTLUint64 struct + func NewIDTTL(ctx context.Context, gcInterval, ttl time.Duration) *TTLUint64 + func (c *TTLUint64) Exists(id uint64) bool + func (c *TTLUint64) Get(id uint64) (interface{}, bool) + func (c *TTLUint64) GetAllID() []uint64 + func (c *TTLUint64) Put(id uint64, value interface{}) + func (c *TTLUint64) PutWithTTL(key uint64, value interface{}, ttl time.Duration) + func (c *TTLUint64) Remove(key uint64) + func (c TTLUint64) Clear() + func (c TTLUint64) Len() int + func (c TTLUint64) UpdateTTL(duration time.Duration) + type TwoQueue struct + func (c *TwoQueue) Elems() []*Item + func (c *TwoQueue) Get(key uint64) (interface{}, bool) + func (c *TwoQueue) Len() int + func (c *TwoQueue) Peek(key uint64) (interface{}, bool) + func (c *TwoQueue) Put(key uint64, value interface{}) + func (c *TwoQueue) Remove(key uint64) + type Type int + const LRUCache + const TwoQueueCache