Documentation ¶
Overview ¶
Package AOP contains the mechanism to bind a Cache Spot to a Go Function, starting from aop.CacheSpot struct.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var EMPTY_MAP = make(map[string]cache.CacheRegistry)
var RGX_FUNCNAME = regexp.MustCompile(`(.*\/)`)
regex that substitute the start of full function name
Functions ¶
Types ¶
type CacheSpot ¶
type CacheSpot struct { CachedFunc interface{} //(required) empty function ref, that will contain cacheable function. Pass a nil reference HotFunc interface{} //(required) real hot function, that will have results cached CacheManager cache.CacheManager //(required) cache manager for cache swaped function StoreOnly bool //(Optional) mark if cache manager can take cached values or just store results CacheIdPrefix string //(Optional) cache prefix for cache registries ValidateResults TypeValidateResults SpecifyInputKeys TypeSpecifyInputKeys SpecifyOutputKeys TypeSpecifyOutputKeys DefValsFunction TypeCreateDefVals WaitingGroup *sync.WaitGroup Ttl float64 CallContext // will be mounted at start up nothing to do }
template to make a cache spot function
func (CacheSpot) MustStartCache ¶
parse function signatures, validators, makes a swap function for reflection operations
func (CacheSpot) WaitAllParallelOps ¶
func (cacheSpot CacheSpot) WaitAllParallelOps()
Wait for all store goroutines.
type CallContext ¶
type CallContext struct {
// contains filtered or unexported fields
}
reflect objects need to reflect function call
type TypeCreateDefVals ¶
implemented by a function that needs to define default values to their returns determine default values for each return an string empty cache key (see method above) means that default value must be used DefaultValubleFunction
type TypeSpecifyInputKeys ¶
To be implemented by a function that will need to define keys for cache SpecifyCacheKeys
type TypeSpecifyOutputKeys ¶
type TypeSpecifyOutputKeys func(ins []reflect.Value, out []reflect.Value) ([]string, []reflect.Value)
contract to be implemented by a function that will need to define keys for cache determine cache key for each return value empty string cachekey means that default value must be used SpecifyOutKeys