MCPcopy Create free account
hub / github.com/conforma/cli / PolicyCacheFromContext

Function PolicyCacheFromContext

internal/policy/cache/cache.go:86–89  ·  view source on GitHub ↗

PolicyCacheFromContext retrieves the PolicyCache from the context. It returns the PolicyCache and true if found, or nil and false otherwise.

(ctx context.Context)

Source from the content-addressed store, hash-verified

84// PolicyCacheFromContext retrieves the PolicyCache from the context.
85// It returns the PolicyCache and true if found, or nil and false otherwise.
86func PolicyCacheFromContext(ctx context.Context) (*PolicyCache, bool) {
87 cache, ok := ctx.Value(policyCacheKey).(*PolicyCache)
88 return cache, ok
89}
90
91// WithPolicyCache returns a new context with the provided PolicyCache added.
92func WithPolicyCache(ctx context.Context, cache *PolicyCache) context.Context {

Callers 2

TestWithPolicyCacheFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestWithPolicyCacheFunction · 0.68