Documentation ¶
Index ¶
- type Cache
- func (c *Cache) Cap() int
- func (c *Cache) Contains(key interface{}) (ok bool)
- func (c *Cache) DelSilently(key interface{})
- func (c *Cache) Delete(key interface{})
- func (c *Cache) Discard() (key, value interface{})
- func (c *Cache) Expiry(key interface{}) (t time.Time, ok bool)
- func (c *Cache) Keys() (keys []interface{})
- func (c *Cache) Len() int
- func (c *Cache) Load(key interface{}) (interface{}, bool)
- func (c *Cache) Peek(key interface{}) (interface{}, bool)
- func (c *Cache) Purge()
- func (c *Cache) RegisterOnEvicted(f func(key, value interface{}))
- func (c *Cache) RegisterOnExpired(f func(key, value interface{}))
- func (c *Cache) Resize(size int) int
- func (c *Cache) SetTTL(ttl time.Duration)
- func (c *Cache) Store(key, value interface{})
- func (c *Cache) StoreWithTTL(key, value interface{}, ttl time.Duration)
- func (c *Cache) TTL() time.Duration
- func (c *Cache) Update(key, value interface{})
- type Collection
- type Entry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an abstracted cache that provides a skeletal implementation, of the Cache interface to minimize the effort required to implement interface.
func (*Cache) DelSilently ¶
func (c *Cache) DelSilently(key interface{})
DelSilently the key value silently without call onEvicted.
func (*Cache) Discard ¶
func (c *Cache) Discard() (key, value interface{})
Discard oldest entry from cache to make room for the new ones.
func (*Cache) RegisterOnEvicted ¶
func (c *Cache) RegisterOnEvicted(f func(key, value interface{}))
RegisterOnEvicted registers a function, to call in its own goroutine when an entry is purged from the cache.
func (*Cache) RegisterOnExpired ¶
func (c *Cache) RegisterOnExpired(f func(key, value interface{}))
RegisterOnExpired registers a function, to call in its own goroutine when an entry TTL elapsed.
func (*Cache) StoreWithTTL ¶
StoreWithTTL sets the key value with TTL overrides the default.
Click to show internal directories.
Click to hide internal directories.