Documentation ¶
Overview ¶
Package ctxmap implements a registry for global context.Context for use in web applications.
Based on work from github.com/gorilla/context, this package simplifies the storage by mapping a pointer to an http.Request to a context.Context. This allows applications to use Google's standard context mechanism to pass state around their web applications, while sticking to the standard http.HandlerFunc implementation for their middleware implementations.
As a result of the simplification, the runtime overhead of the package is reduced by 30 to 40 percent in my tests. However, it would be common to store a map of values or a pointer to a structure in the Context object, and my testing does not account for time taken beyond calling Context.Value().
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearHandler ¶
ClearHandler wraps an http.Handler and clears request values at the end of a request lifetime.
func Delete ¶
Delete removes the context for a given request.
This is usually called by a handler wrapper to clean up request variables at the end of a request lifetime. See ClearHandler().
Types ¶
This section is empty.