Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cacher ¶
type Cacher interface { // Put inserts an element into the cache. If spaced is required, elements will // be evicted. Put(key ids.ID, value interface{}) // Get returns the entry in the cache with the key specified, if no value // exists, false is returned. Get(key ids.ID) (interface{}, bool) // Evict removes the specified entry from the cache Evict(key ids.ID) // Flush removes all entries from the cache Flush() }
Cacher acts as a best effort key value store
type Deduplicator ¶
type Deduplicator interface { // Deduplicate returns either the provided value, or a previously provided // value with the same ID that hasn't yet been evicted Deduplicate(Evictable) Evictable // Flush removes all entries from the cache Flush() }
Deduplicator acts as a best effort deduplication service
type EvictableLRU ¶
type EvictableLRU struct { Size int // contains filtered or unexported fields }
EvictableLRU is an LRU cache that notifies the objects when they are evicted.
func (*EvictableLRU) Deduplicate ¶
func (c *EvictableLRU) Deduplicate(value Evictable) Evictable
Deduplicate implements the Deduplicator interface
func (*EvictableLRU) Flush ¶
func (c *EvictableLRU) Flush()
Flush implements the Deduplicator interface
type LRU ¶
type LRU struct { Size int // contains filtered or unexported fields }
LRU is a key value store with bounded size. If the size is attempted to be exceeded, then an element is removed from the cache before the insertion is done, based on evicting the least recently used value.
Click to show internal directories.
Click to hide internal directories.