Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TimerStore ¶
TimerStore describes a timer store.
A timer store keeps track of timers in a map. A finished timer is always removed from the map after its execution.
func (*TimerStore) Exists ¶
func (ts *TimerStore) Exists(id interface{}) bool
Exists returns true if a timer is running for the given ID.
func (*TimerStore) Start ¶
func (ts *TimerStore) Start(id interface{}, duration time.Duration, f func())
Start starts a new timer that will execute the given function "f" after "duration". It stores the time.Timer in the store and removes it when the function finishes.
func (*TimerStore) Stop ¶
func (ts *TimerStore) Stop(id interface{}) (res bool)
Stop cancels a timer and removes it from the store.
Click to show internal directories.
Click to hide internal directories.