Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CtxMap ¶ added in v1.1.0
type CtxMap interface {
Load(key interface{}) (value interface{}, ok bool)
Store(ctx context.Context, key, value interface{})
Delete(key interface{})
Range(f func(key, value interface{}) bool)
}
CtxMap stores provided key/value pairs with context.
type Timap ¶
type Timap interface {
Load(key interface{}) (value interface{}, ok bool)
Store(key, value interface{}, lifeTime ...time.Duration)
Delete(key interface{})
Range(f func(key, value interface{}) bool)
}
Timap represents "time map", it is a wrapper over sync.Map that allows to store key-value pairs for certain period of time. Default duration can be defined for all key-value pairs in the constructor func, but it is also possible to define custom life time for each pair separately. Watcher will create a goroutine for every temporrary pair. Try not to use it with huge maps.
Click to show internal directories.
Click to hide internal directories.