Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Zero value - the cache is open and ready to use OPEN = 0 // Closed value - the cache shouldn't be used CLOSED = 1 )
Constants for IsOpen indicators.
Go 1.17 adds atomic.Value.Swap which is great, but 1.19 adds atomic.Bool and other types. This is a go <1.13 cludge.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a synchronized map of items that auto-expire once stale
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) GetNoExtend ¶
GetNoExtend is a thread-safe way to lookup items Every lookup, also touches the item, hence extending it's life
type DRL ¶
type DRL struct { Servers *Cache ThisServerID string CurrentTotal int64 RequestTokenValue int // contains filtered or unexported fields }
func (*DRL) AddOrUpdateServer ¶
func (*DRL) CurrentTokenValue ¶
func (*DRL) SetCurrentTokenValue ¶
Click to show internal directories.
Click to hide internal directories.