Documentation
¶
Index ¶
- type Cache
- func (ec *Cache) ApproximateCleaner(d time.Duration)
- func (ec *Cache) Cleaner(d time.Duration)
- func (ec *Cache) Get(k string) (item interface{}, ok bool)
- func (ec *Cache) GetOrSet(k string, newValue interface{}, size uint64, expire int32) (item interface{})
- func (ec *Cache) Items() int
- func (ec *Cache) Set(k string, v interface{}, size uint64, expire int32)
- func (ec *Cache) Size() uint64
- func (ec *Cache) StoppableApproximateCleaner(d time.Duration, exit <-chan struct{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
Cache is an expiring cache. It is safe for
func (*Cache) ApproximateCleaner ¶
ApproximateCleaner starts a goroutine which wakes up periodically and removes a sample of expired items from the cache.
func (*Cache) Cleaner ¶
Cleaner starts a goroutine which wakes up periodically and removes all expired items from the cache.
func (*Cache) GetOrSet ¶
func (ec *Cache) GetOrSet(k string, newValue interface{}, size uint64, expire int32) (item interface{})
GetOrSet returns the item from the cache or sets a new variable if it doesn't exist
func (*Cache) Set ¶
Set adds an item to the cache, with an estimated size and expiration time in seconds.
func (*Cache) StoppableApproximateCleaner ¶
Click to show internal directories.
Click to hide internal directories.