Versions in this module Expand all Collapse all v0 v0.0.1 May 3, 2023 Changes in this version + var ErrKeyNotFound = errors.New("Key not found in cache") + var ErrKeyNotFoundOrLoadable = errors.New("Key not found and could not be loaded into cache") + type CacheItem struct + func NewCacheItem(key interface{}, lifeSpan time.Duration, data interface{}) *CacheItem + func (item *CacheItem) AccessCount() int64 + func (item *CacheItem) AccessedOn() time.Time + func (item *CacheItem) AddAboutToExpireCallback(f func(interface{})) + func (item *CacheItem) CreatedOn() 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) RemoveAboutToExpireCallback() + func (item *CacheItem) SetAboutToExpireCallback(f func(interface{})) + type CacheItemPair struct + AccessCount int64 + Key interface{} + type CacheItemPairList []CacheItemPair + func (p CacheItemPairList) Len() int + func (p CacheItemPairList) Less(i, j int) bool + func (p CacheItemPairList) Swap(i, j int) + type CacheTable struct + func Cache(table string) *CacheTable + func (table *CacheTable) Add(key interface{}, lifeSpan time.Duration, data interface{}) *CacheItem + func (table *CacheTable) AddAboutToDeleteItemCallback(f func(*CacheItem)) + func (table *CacheTable) AddAddedItemCallback(f func(*CacheItem)) + func (table *CacheTable) Count() int + func (table *CacheTable) Delete(key interface{}) (*CacheItem, error) + func (table *CacheTable) Exists(key interface{}) bool + func (table *CacheTable) Flush() + func (table *CacheTable) Foreach(trans func(key interface{}, item *CacheItem)) + func (table *CacheTable) MostAccessed(count int64) []*CacheItem + func (table *CacheTable) NotFoundAdd(key interface{}, lifeSpan time.Duration, data interface{}) bool + func (table *CacheTable) RemoveAboutToDeleteItemCallback() + func (table *CacheTable) RemoveAddedItemCallbacks() + func (table *CacheTable) SetAboutToDeleteItemCallback(f func(*CacheItem)) + func (table *CacheTable) SetAddedItemCallback(f func(*CacheItem)) + func (table *CacheTable) SetDataLoader(f func(interface{}, ...interface{}) *CacheItem) + func (table *CacheTable) SetLogger(logger *log.Logger) + func (table *CacheTable) Value(key interface{}, args ...interface{}) (*CacheItem, error)