Documentation
¶
Index ¶
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 ¶
Set Health Check Max Attempt on Background Context
func SetTimeout ¶
Set Health Check Time Out on Background Context
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.