Files
streamctl/pkg/streamd/memoize/cache.go
2024-08-03 22:18:52 +01:00

25 lines
359 B
Go

package memoize
import (
"context"
)
type CtxKey string
const (
CtxKeyNoCache = CtxKey("no_cache")
)
func IsNoCache(ctx context.Context) bool {
v := ctx.Value(CtxKeyNoCache)
if v == nil {
return false
}
b, _ := v.(bool)
return b
}
func SetNoCache(ctx context.Context, b bool) context.Context {
return context.WithValue(ctx, CtxKeyNoCache, b)
}