Documentation
¶
Index ¶
- Constants
- type CacheTable
- func (table *CacheTable) Add(key string, lifeSpan time.Duration, data interface{}) *CachedItem
- func (table *CacheTable) Clear()
- func (table *CacheTable) Delete(key string) (*CachedItem, error)
- func (table *CacheTable) Fetch(key string, f func() (interface{}, error)) (interface{}, error)
- func (table *CacheTable) Value(key string, args ...interface{}) (interface{}, error)
- type CachedItem
- func (item *CachedItem) Fetch(f func() (interface{}, error)) (interface{}, error)
- func (item *CachedItem) SetData(data interface{})
- func (item *CachedItem) SetDataLoader(f func(...interface{}) (interface{}, error))
- func (item *CachedItem) Stop()
- func (item *CachedItem) Value(args ...interface{}) (interface{}, error)
- type ErrNotFound
Constants ¶
View Source
const ( MIN_CACHE_LIFESPAN = 10 * time.Second DEFAULT_CACHE_LIFESPAN = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheTable ¶
func NewCacheTable ¶
func NewCacheTable() *CacheTable
func (*CacheTable) Add ¶
func (table *CacheTable) Add(key string, lifeSpan time.Duration, data interface{}) *CachedItem
func (*CacheTable) Clear ¶
func (table *CacheTable) Clear()
func (*CacheTable) Delete ¶
func (table *CacheTable) Delete(key string) (*CachedItem, error)
func (*CacheTable) Fetch ¶
func (table *CacheTable) Fetch(key string, f func() (interface{}, error)) (interface{}, error)
func (*CacheTable) Value ¶
func (table *CacheTable) Value(key string, args ...interface{}) (interface{}, error)
type CachedItem ¶
func NewCachedItem ¶
func NewCachedItem(key string, lifeSpan time.Duration, data interface{}, loader func(...interface{}) (interface{}, error)) *CachedItem
func (*CachedItem) Fetch ¶
func (item *CachedItem) Fetch(f func() (interface{}, error)) (interface{}, error)
func (*CachedItem) SetData ¶
func (item *CachedItem) SetData(data interface{})
func (*CachedItem) SetDataLoader ¶
func (item *CachedItem) SetDataLoader(f func(...interface{}) (interface{}, error))
func (*CachedItem) Stop ¶
func (item *CachedItem) Stop()
func (*CachedItem) Value ¶
func (item *CachedItem) Value(args ...interface{}) (interface{}, error)
type ErrNotFound ¶
type ErrNotFound string
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
Click to show internal directories.
Click to hide internal directories.