Documentation ¶
Overview ¶
Package whcache provides a mechanism for per-request computation caching
Sometimes you have a helper method that performs a computation or interacts with a datastore or remote resource, and that helper method gets called repeatedly. With simple context values, since the helper method is the most descendent frame in the stack, there isn't a context specific place (besides maybe the session, which would be a bad choice) to cache context specific values. With this cache helper, there now is.
The cache must be registered up the handler chain with Register, and then helper methods can use Set/Get/Remove to interact with the cache (if available). If no cache was registered, Set/Get/Remove will still work, but Get will never return a value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get returns previously stored key/value pairs from the context specific cache if one is registered and the value is found, and returns nil otherwise.
Types ¶
This section is empty.