Documentation ¶
Index ¶
- Variables
- type CacheItem
- func (item *CacheItem) AccessCount() int64
- func (item *CacheItem) AccessedTime() time.Time
- func (item *CacheItem) CreatedTime() time.Time
- func (item *CacheItem) Data() interface{}
- func (item *CacheItem) KeepAlive()
- func (item *CacheItem) Key() interface{}
- func (item *CacheItem) LifeSpan() time.Duration
- func (item *CacheItem) SetDeleteCallback(f func(interface{}))
- type CacheItemPair
- type CacheItemPairList
- type Table
- func (table *Table) Clear()
- func (table *Table) Count() int
- func (table *Table) Delete(key interface{}) (*CacheItem, error)
- func (table *Table) Exists(key interface{}) bool
- func (table *Table) ForEach(trans func(key interface{}, item *CacheItem))
- func (table *Table) Get(key interface{}, args ...interface{}) (*CacheItem, error)
- func (table *Table) MostAccessed(count int64) []*CacheItem
- func (table *Table) NotFoundAdd(key interface{}, lifeSpan time.Duration, data interface{}) bool
- func (table *Table) Set(key interface{}, lifeSpan time.Duration, data interface{}) *CacheItem
- func (table *Table) SetAddCallback(f func(*CacheItem))
- func (table *Table) SetDeleteCallback(f func(*CacheItem))
- func (table *Table) SetLoadNotCallback(f func(interface{}, ...interface{}) *CacheItem)
- func (table *Table) SetLogger(logger *log.Logger)
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 ¶
This section is empty.
Types ¶
type CacheItem ¶
CacheItem CacheItem
func (*CacheItem) AccessedTime ¶
AccessedTime AccessedTime
func (*CacheItem) CreatedTime ¶
CreatedTime CreatedTime
func (*CacheItem) SetDeleteCallback ¶
func (item *CacheItem) SetDeleteCallback(f func(interface{}))
SetDeleteCallback SetDeleteCallback
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 Table ¶
Table Table
func (*Table) MostAccessed ¶
MostAccessed MostAccessed
func (*Table) NotFoundAdd ¶
NotFoundAdd NotFoundAdd
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.