Documentation ¶
Index ¶
- Constants
- func CombineData(ttl time.Duration, val []byte) []byte
- func CopyBytes(data []byte) []byte
- func CutStringSlice(keys []string, prefix, limit string) []string
- func GetTimeNow() time.Time
- func SplitData(val []byte) (bool, int, []byte)
- type EvictCallback
- type LRU
- func (c *LRU) Add(key, value interface{}) (evicted bool)
- func (c *LRU) Clear()
- func (c *LRU) Contains(key interface{}) (ok bool)
- func (c *LRU) Get(key interface{}) (value interface{}, ok bool)
- func (c *LRU) GetOldest() (key, value interface{}, ok bool)
- func (c *LRU) Keys() []interface{}
- func (c *LRU) Len() int
- func (c *LRU) Peek(key interface{}) (value interface{}, ok bool)
- func (c *LRU) Remove(key interface{}) (present bool)
- func (c *LRU) RemoveOldest() (key, value interface{}, ok bool)
- func (c *LRU) Resize(size int) (evicted int)
Constants ¶
View Source
const DefaultEvictedBufferSize = 16
Variables ¶
This section is empty.
Functions ¶
func CutStringSlice ¶
func GetTimeNow ¶ added in v1.0.3
Types ¶
type EvictCallback ¶
type EvictCallback func(key interface{}, value interface{})
type LRU ¶
type LRU struct {
// contains filtered or unexported fields
}
func NewLRU ¶
func NewLRU(size int, onEvict EvictCallback) *LRU
func (*LRU) RemoveOldest ¶
Click to show internal directories.
Click to hide internal directories.