Documentation
¶
Overview ¶
Package cache provides interfaces for cache functions
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Set(k Key, d Data) Get(k Key) (Data, bool) Delete(k Key) // Size returns the count in bytes of the cache Size() uint64 ElementsCount() uint64 Clear() Evict(n int) Capacity() uint64 SetCapacity(cap uint64) // Full returns whether current cache is full or not Full() bool }
Cache is the common interface implemented by all cache functions
type Data ¶
type Data interface { // Size returns the count in bytes of this data Size() uint64 }
Data is the interface to insert data to the cache
type Option ¶
type Option interface { // Capacity returns the current max allowed bytes // to store in the cache // Zero means no limitation. Capacity() uint64 // SetCapacity sets the max allowed bytes // to store in the cache // Zero means no limitation. SetCapacity(cap uint64) // MaxElements returns current max elements totally // to store in the cache // Zero means no limitation. MaxElements() uint64 // SetMaxElements sets the max count of elements // to store in the cache. // Zero means no limitation. SetMaxElements(count uint64) }
Directories
¶
Path | Synopsis |
---|---|
This package implements a O(1) LFU Followed the origin paper http://dhruvbird.com/lfu.pdf
|
This package implements a O(1) LFU Followed the origin paper http://dhruvbird.com/lfu.pdf |
Package lru provides one implementation of the LRU cache
|
Package lru provides one implementation of the LRU cache |
Click to show internal directories.
Click to hide internal directories.