Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExecutedCommand ¶
type ExecutedCommand struct {
// contains filtered or unexported fields
}
ExecutedCommand holds a response or response error and the execution info of the previously executed command.
func (*ExecutedCommand) ExecutionInfo ¶
func (c *ExecutedCommand) ExecutionInfo() *requestlog.ExecutionInfo
ExecutionInfo returns an ExecutionInfo for the executed command. Execution time for cached responses is always zero.
func (*ExecutedCommand) Response ¶
func (c *ExecutedCommand) Response() (interface{}, error)
Response returns a response or error stored from command execution.
type RequestCache ¶
type RequestCache struct {
// contains filtered or unexported fields
}
ResponseCache is a cache of command responses. It is safe to access ResponseCache from multiple thread.
func FromContext ¶
func FromContext(ctx context.Context) *RequestCache
func (*RequestCache) Add ¶
func (c *RequestCache) Add( name, key string, info requestlog.ExecutionInfo, r interface{}, err error)
Add adds a command response and execution info to the cache to be reused by later executions of the command.
func (*RequestCache) Get ¶
func (c *RequestCache) Get(name, key string) *ExecutedCommand
Get performs a lookup in the cache for the cached command with the given name and key. If no previous execution is in the cache nil is returned.