Documentation
¶
Index ¶
- type Cache
- func (c *Cache) Add(key, value interface{}) bool
- func (c *Cache) Contains(key interface{}) (ok bool)
- func (c *Cache) Get(key interface{}) (interface{}, bool)
- func (c *Cache) Keys() []interface{}
- func (c *Cache) Len() int
- func (c *Cache) Purge()
- func (c *Cache) Remove(key interface{}) bool
- func (c *Cache) RemoveWithCond(key interface{}, fn cond) bool
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 implements a thread safe cache
func (*Cache) Add ¶
Add adds a value to the cache, return false if the entry already exists in cache and update the value
func (*Cache) Contains ¶
Contains checks if a key is in the cache, without return the value related to the key
func (*Cache) Keys ¶
func (c *Cache) Keys() []interface{}
Keys returns a slice of the keys in the cache, out of the order
func (*Cache) Remove ¶
Remove removes the provided key from the cache, return true if the key was contained.
func (*Cache) RemoveWithCond ¶
RemoveWithCond removes elements if their keys are equal to the provided key according to fn
Click to show internal directories.
Click to hide internal directories.