luci: go.chromium.org/luci/common/data/caching/cacheContext Index | Files

package cacheContext

import "go.chromium.org/luci/common/data/caching/cacheContext"

Package cacheContext implements a context.Context wrapper which caches the results of Value calls, speeding up subsequent calls for the same key.

Context values are stored as immutable layers in a backwards-referenced list. Each lookup traverses the list from tail to head looking for a layer with the requested value. As a Context retains more values, this traversal will get more expensive. This class can be used for large Contexts to avoid repeatedly paying the cost of traversal for the same read-only value.

Index

Package Files

context.go

func Wrap Uses

func Wrap(c context.Context) context.Context

Wrap wraps the supplied Context in a caching Context. All Value lookups will be cached at this level, avoiding the expense of future Context traversals for that same key.

Package cacheContext imports 2 packages (graph) and is imported by 4 packages. Updated 2018-08-21. Refresh now. Tools for package owners.