Documentation ¶
Index ¶
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 a synchronised map of items that auto-expire once stale
func (*Cache) Close ¶
func (c *Cache) Close()
Close remove all data from Cache and exit cleanup. Cache cannot use any more after close
func (*Cache) Get ¶
Get is a thread-safe way to lookup items. Every lookup, also hence extending it's life if ttl is enabled
type CacheOption ¶
type CacheOption func(*Cache)
func CacheWithLRU ¶
func CacheWithLRU(cap int) CacheOption
func CacheWithTTL ¶
func CacheWithTTL(d time.Duration, refreshMode TTLRefreshMode) CacheOption
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func NewCounter ¶
NewCounter create a counter with TTL records
type TTLRefreshMode ¶ added in v0.0.12
type TTLRefreshMode uint8
const ( TTLRefreshModeGet TTLRefreshMode = 1 << iota TTLRefreshModeSet TTLRefreshModeNone TTLRefreshMode = 0 )
Click to show internal directories.
Click to hide internal directories.