Documentation ¶
Index ¶
- Variables
- func Clear()
- func Get(key interface{}) (value interface{}, err error)
- func Set(key, data interface{}, lifeSpan uint, interval ...bool)
- func SetDeleteCallback(f func(*Item) bool)
- func SetLogger(logger *zlog.Logger)
- type CacheItemPair
- type CacheItemPairList
- type Item
- func (item *Item) AccessCount() int64
- func (item *Item) AccessedTime() time.Time
- func (item *Item) CreatedTime() time.Time
- func (item *Item) Data() interface{}
- func (item *Item) Key() interface{}
- func (item *Item) LifeSpan() time.Duration
- func (item *Item) LifeSpanUint() uint
- func (item *Item) RemainingLife() time.Duration
- func (item *Item) SetDeleteCallback(fn func(item *Item) bool)
- type Table
- func (table *Table) Add(key interface{}, data interface{}, lifeSpan time.Duration, ...) bool
- func (table *Table) Clear()
- func (table *Table) Count() int
- func (table *Table) Delete(key interface{}) (*Item, error)
- func (table *Table) Exists(key interface{}) bool
- func (table *Table) ForEach(trans func(key, value interface{}))
- func (table *Table) Get(key interface{}, args ...interface{}) (value interface{}, err error)
- func (table *Table) GetRaw(key interface{}, args ...interface{}) (*Item, error)
- func (table *Table) MostAccessed(count int64) []*Item
- func (table *Table) Set(key, data interface{}, lifeSpan uint, interval ...bool) *Item
- func (table *Table) SetAddCallback(f func(*Item))
- func (table *Table) SetDeleteCallback(f func(*Item) bool)
- func (table *Table) SetLoadNotCallback(f func(key interface{}, args ...interface{}) *Item)
- func (table *Table) SetLogger(logger *zlog.Logger)
- func (table *Table) SetRaw(key, data interface{}, lifeSpan time.Duration, intervalLifeSpan ...bool) *Item
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrKeyNotFound ErrKeyNotFound ErrKeyNotFound = errors.New("key is not in cache") // ErrKeyNotFoundAndNotCallback ErrKeyNotFoundAndNotCallback ErrKeyNotFoundAndNotCallback = errors.New("key is not in cache and no callback is set") )
Functions ¶
func SetDeleteCallback ¶ added in v0.0.20
Types ¶
type CacheItemPair ¶
type CacheItemPair struct { Key interface{} AccessCount int64 }
CacheItemPair maps key to access counter
type CacheItemPairList ¶
type CacheItemPairList []CacheItemPair
CacheItemPairList CacheItemPairList
func (CacheItemPairList) Len ¶
func (p CacheItemPairList) Len() int
func (CacheItemPairList) Less ¶
func (p CacheItemPairList) Less(i, j int) bool
func (CacheItemPairList) Swap ¶
func (p CacheItemPairList) Swap(i, j int)
type Item ¶ added in v0.0.20
Item Item
func (*Item) AccessCount ¶ added in v0.0.20
AccessCount AccessCount
func (*Item) AccessedTime ¶ added in v0.0.20
AccessedTime AccessedTime
func (*Item) CreatedTime ¶ added in v0.0.20
CreatedTime CreatedTime
func (*Item) LifeSpanUint ¶ added in v0.0.20
LifeSpanUint LifeSpanUint
func (*Item) RemainingLife ¶ added in v0.0.20
RemainingLife RemainingLife
func (*Item) SetDeleteCallback ¶ added in v0.0.20
SetDeleteCallback SetDeleteCallback
type Table ¶
Table Table
func (*Table) Add ¶ added in v0.0.19
func (table *Table) Add(key interface{}, data interface{}, lifeSpan time.Duration, intervalLifeSpan ...bool) bool
Add Add
func (*Table) ForEach ¶
func (table *Table) ForEach(trans func(key, value interface{}))
ForEach ForEach
func (*Table) MostAccessed ¶
MostAccessed MostAccessed
func (*Table) SetAddCallback ¶
SetAddCallback SetAddCallback
func (*Table) SetDeleteCallback ¶
SetDeleteCallback SetDeleteCallback
func (*Table) SetLoadNotCallback ¶
SetLoadNotCallback SetLoadNotCallback
Click to show internal directories.
Click to hide internal directories.