Documentation
¶
Index ¶
- func ClearContext(context Context)
- func GetGoContext(context Context) goContext.Contextdeprecated
- func GoContext(context Context) goContext.Context
- func SetMaxAttempt(context Context, maxAttempt int)deprecated
- func SetTimeout(context Context, timeout time.Duration)deprecated
- type Context
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearContext ¶
func ClearContext(context Context)
Clear Background Context, best used with a defer function after creating the new context.
func GetGoContext
deprecated
func SetMaxAttempt
deprecated
func SetTimeout
deprecated
Types ¶
type Context ¶
type Context interface {
// Set content to map, cannot use the same key value over and over again, otherwise it will panic.
Set(key, value interface{})
// Get content from map, return two values, the bool value indicated if it was found or not.
Get(key interface{}) (interface{}, bool)
// The fn function only gets called if there is a cache miss. Return error as nil to bypass health check.
Persist(key interface{}, fn func() (interface{}, error)) interface{}
}
func NewBackgroundContext ¶
func NewBackgroundContext() Context
New Background Context, default max attempt is 5 and timeout is 2 seconds
func NewContext ¶
New Context, default max attempt is 1 and timeout is 0
func NewContextWithMap ¶
func NewContextWithMap(m map[interface{}]interface{}) Context
New Context with Map, default max attempt is 1 and timeout is 0
Click to show internal directories.
Click to hide internal directories.