Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DurationStore ¶
type DurationStore struct {
// Underlying data store
sync.Map
// contains filtered or unexported fields
}
DurationStore{} stores arbitrary time.Duration. It allows for safe pushes and pops based on any arbitrary keys.
func NewDurationStore ¶
func NewDurationStore(eval func(oldDur, newDur time.Duration) bool) *DurationStore
NewDurationStore() returns a duration store which will evaluate which value to keep, when multiple are pushed to the same key, based on the eval() function.
func (*DurationStore) Peek ¶
func (dm *DurationStore) Peek(key string) time.Duration
Peek() will return the duration stored by the key and *not* delete the store. If no duration was stored for that key, then 0 will be returned.
Click to show internal directories.
Click to hide internal directories.