Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedEvaluator ¶
type CachedEvaluator interface {
GetCacheOnly() (value interface{})
Get(ctx context.Context) (value interface{}, err error)
// Evaluate is the same as Get, except:
// Evaluate always ensures a Goroutine is evaluating. If there are no Goroutines evaluating then
// evaluator is called.
Evaluate(ctx context.Context) (value interface{}, err error)
}
CachedEvaluator is a cache for an evaluator (a function) such that the evaluator is expensive enough to justify ensuring that only one Goroutine should be running the evaluator at any one time (and other Goroutines will wait as needed). A CachedEvaluator should be wrapped for type-safety. See NewCachedEvaluator.
func NewCachedEvaluator ¶
func NewCachedEvaluator(evaluator func(ctx context.Context) (value interface{}, err error)) (CachedEvaluator, error)
NewCachedEvaluator returns a cache for calls to evaluator, as defined by CachedEvaluator.
Click to show internal directories.
Click to hide internal directories.