Documentation
¶
Overview ¶
Package cache provides cache strategy support of the kv system, currently we have fifo, lru (default), lfu ...
Index ¶
- Constants
- type Cache
- type FIFOCache
- func (c *FIFOCache) Bytes() int64
- func (c *FIFOCache) Get(key string) (value Value, ok bool)
- func (c *FIFOCache) Has(key string) bool
- func (c *FIFOCache) Keys() []string
- func (c *FIFOCache) Len() int
- func (c *FIFOCache) Remove(key string)
- func (c *FIFOCache) Set(key string, value Value, ttl time.Duration)
- func (c *FIFOCache) Shrink()
- type LFUCache
- func (c *LFUCache) Bytes() int64
- func (c *LFUCache) Get(key string) (v Value, ok bool)
- func (c *LFUCache) Has(key string) bool
- func (c *LFUCache) Keys() []string
- func (c *LFUCache) Len() int
- func (c *LFUCache) Remove(key string)
- func (c *LFUCache) Set(key string, value Value, ttl time.Duration)
- func (c *LFUCache) Shrink()
- type LRUCache
- func (c *LRUCache) Bytes() int64
- func (c *LRUCache) Get(key string) (value Value, ok bool)
- func (c *LRUCache) Has(key string) bool
- func (c *LRUCache) Keys() []string
- func (c *LRUCache) Len() int
- func (c *LRUCache) Remove(key string)
- func (c *LRUCache) Set(key string, value Value, ttl time.Duration)
- func (c *LRUCache) Shrink()
- type Value
Constants ¶
View Source
const ( CACHE_STRATEGY_FIFO = "fifo" CACHE_STRATEGY_LRU = "lru" CACHE_STRATEGY_LFU = "lfu" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Get(key string) (Value, bool) Set(key string, value Value, ttl time.Duration) Remove(key string) Keys() []string Len() int Has(key string) bool Bytes() int64 Shrink() }
func NewDefaultCache ¶
Click to show internal directories.
Click to hide internal directories.