Documentation
¶
Overview ¶
This package implements a fixed-size thread safe *R+log(C)* cache.
Index ¶
- type Cache
- func (c *Cache) Add(key, value interface{}) (evicted bool)
- func (c *Cache) Contains(key interface{}) bool
- func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool)
- func (c *Cache) Get(key interface{}) (value interface{}, ok bool)
- func (c *Cache) GetOldest() (key interface{}, value interface{}, ok bool)
- func (c *Cache) Len() int
- func (c *Cache) Peek(key interface{}) (value interface{}, ok bool)
- func (c *Cache) PeekOrAdd(key, value interface{}) (previous interface{}, ok, evicted bool)
- func (c *Cache) Remove(key interface{}) (present bool)
- func (c *Cache) RemoveOldest() (key interface{}, value interface{}, ok bool)
- func (c *Cache) Resize(size int) (evicted int)
- type EvictCB
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
}
func (*Cache) Contains ¶
Looks up a cache entry without updating the cache statistics and witout returning it's value.
func (*Cache) ContainsOrAdd ¶
func (*Cache) PeekOrAdd ¶
Looks up a cache entry without updating the cache statistics and adds a new entry, if no cache entry was found.
func (*Cache) RemoveOldest ¶
Click to show internal directories.
Click to hide internal directories.