Documentation ¶
Overview ¶
Create a map that will timeout entries and call a callback when an object in the map has expired
Index ¶
- func Noop(obj interface{})
- type Node
- type TimeoutMap
- func (m *TimeoutMap) Add(key string, obj interface{}, ttl time.Duration, ...)
- func (m *TimeoutMap) Checkin(key string) bool
- func (m *TimeoutMap) Delete(key string)
- func (m *TimeoutMap) Get(key string) (interface{}, bool)
- func (m *TimeoutMap) Keys() []string
- func (m *TimeoutMap) Start(period time.Duration)
- func (m *TimeoutMap) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TimeoutMap ¶
func New ¶
func New(synchronousExpire bool, quit <-chan struct{}) *TimeoutMap
func (*TimeoutMap) Add ¶
func (m *TimeoutMap) Add(key string, obj interface{}, ttl time.Duration, timeoutFunc func(obj interface{}))
func (*TimeoutMap) Checkin ¶
func (m *TimeoutMap) Checkin(key string) bool
func (*TimeoutMap) Delete ¶
func (m *TimeoutMap) Delete(key string)
func (*TimeoutMap) Get ¶
func (m *TimeoutMap) Get(key string) (interface{}, bool)
func (*TimeoutMap) Keys ¶
func (m *TimeoutMap) Keys() []string
func (*TimeoutMap) Start ¶
func (m *TimeoutMap) Start(period time.Duration)
We could create a goroutine for each element in the map and fire timers off of that but it seems a bit excessive instead just clean up the map periodically
func (*TimeoutMap) Stop ¶
func (m *TimeoutMap) Stop()
Click to show internal directories.
Click to hide internal directories.