Documentation ¶
Index ¶
- type Cache
- func (cache *Cache) ContainsKey(key string) (found bool)
- func (cache *Cache) ContainsKeyAndUpdate(key string, value string) (found bool)
- func (cache *Cache) Count() int
- func (cache *Cache) Get(key string) (data string, found bool)
- func (cache *Cache) Set(key string, data string)
- func (cache *Cache) SetWithTtl(key string, data string, duration time.Duration)
- func (cache *Cache) ToStringMap() map[string]string
- type Item
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { Mutex sync.RWMutex Ttl time.Duration TtlInterval time.Duration Items map[string]*Item }
Cache is a synchronised map of Items that auto-expire once stale https://github.com/microsoftarchive/ttlcache @Description:
func (*Cache) ContainsKey ¶
Set is a thread-safe way to add new Items to the map
func (*Cache) ContainsKeyAndUpdate ¶ added in v0.1.14
Set is a thread-safe way to add new Items to the map
func (*Cache) Count ¶
Count returns the number of Items in the cache (helpful for tracking memory leaks)
func (*Cache) Get ¶
Get is a thread-safe way to lookup Items Every lookup, also touches the item, hence extending it's life
func (*Cache) SetWithTtl ¶ added in v0.1.14
Set is a thread-safe way to add new Items to the map
func (*Cache) ToStringMap ¶ added in v0.1.13
Click to show internal directories.
Click to hide internal directories.