MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / NewContextWithCache

Function NewContextWithCache

pkg/auth/rights/rights.go:168–170  ·  view source on GitHub ↗

NewContextWithCache returns a derived context with a rights cache. This should only be used for request contexts.

(ctx context.Context)

Source from the content-addressed store, hash-verified

166// NewContextWithCache returns a derived context with a rights cache.
167// This should only be used for request contexts.
168func NewContextWithCache(ctx context.Context) context.Context {
169 return context.WithValue(ctx, rightsCacheKey, &Rights{})
170}
171
172func cacheInContext(ctx context.Context, f func(*Rights)) {
173 if rights, ok := ctx.Value(rightsCacheKey).(*Rights); ok {

Callers 1

NewFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected