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.
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.
Register installs a cache in the handler chain.
Remove removes any values stored with key from the context specific cache, if possible.
Set stores the key/val pair in the context specific cache, if possible.