Versions in this module Expand all Collapse all v1 v1.0.0 Oct 21, 2022 Changes in this version + const Memory + const Redis + const RedisSentinel + var ErrorNotFound = errors.New("Key not found") + func FetchOrSave(ctx context.Context, c Cache, key string, value interface{}, ...) error + func Initialize(t, addr string) error + func NewContext(ctx context.Context, c Cache) context.Context + func Register(t string, factory func(opts Options) (Cache, error)) + type Cache interface + Contain func(ctx context.Context, key string) bool + Delete func(ctx context.Context, key string) error + Fetch func(ctx context.Context, key string, value interface{}) error + Keys func(ctx context.Context, prefixes ...string) ([]string, error) + Ping func(ctx context.Context) error + Save func(ctx context.Context, key string, value interface{}, ...) error + func Default() Cache + func FromContext(ctx context.Context) (Cache, bool) + func New(t string, opt ...Option) (Cache, error) + type Codec interface + Decode func(data []byte, v interface{}) error + Encode func(v interface{}) ([]byte, error) + func DefaultCodec() Codec + type Option func(*Options) + func Address(addr string) Option + func Expiration(d time.Duration) Option + func Prefix(prefix string) Option + type Options struct + Address string + Codec Codec + Expiration time.Duration + Prefix string + func (opts *Options) Key(key string) string