Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCacheNotFound = errors.New("cache not found")
)
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Get(ctx context.Context, key string) ([]byte, error) Set(ctx context.Context, key string, value []byte, exp time.Duration) error Del(ctx context.Context, key string) error }
func NewLocalCache ¶
func NewRedisCache ¶
func NewRedisCache(client redis.UniversalClient) Cache
type ObjectCache ¶
type ObjectCache interface { Get(ctx context.Context, key string, dst any) error Set(ctx context.Context, key string, val any, exp time.Duration) error Del(ctx context.Context, key string) error }
func JSONCache ¶
func JSONCache(cache Cache) ObjectCache
func NewObjectCache ¶
type Option ¶
type Option func(o *cacheWithOptions)
func WithIgnoreNotFound ¶
func WithIgnoreNotFound() Option
func WithPrefix ¶
Click to show internal directories.
Click to hide internal directories.