Documentation
¶
Overview ¶
Package cachemanager provides typed cache operations and the concrete CacheManager implementation.
Index ¶
- Variables
- func DeleteCacheItem[T any](ctx context.Context, cacheHandle cache.Cache[T], key string, ...) (err error)
- func GetCacheItem[T any](ctx context.Context, cacheHandle cache.Cache[T], key string, ...) (res T, err error)
- func NewCacheManager(redisCli *redis.Client, localCli cache.LocalStore, cfg cache.Config) (cache.CacheManager, error)
- func NewCacheOperation[T any](manager cache.CacheManager) (cache.Cache[T], error)
- func SaveCacheItem[T any](ctx context.Context, cacheHandle cache.Cache[T], key string, value T, ...) (err error)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidCacheType = errors.New("invalid cache type")
ErrInvalidCacheType indicates that a cache operation was configured with an unsupported CacheType.
Functions ¶
func DeleteCacheItem ¶
func DeleteCacheItem[T any](ctx context.Context, cacheHandle cache.Cache[T], key string, optFns ...cache.CacheOption) (err error)
DeleteCacheItem deletes key from cacheHandle with retry on transient errors. Cache misses are treated as successful deletes.
func GetCacheItem ¶
func GetCacheItem[T any](ctx context.Context, cacheHandle cache.Cache[T], key string, optFns ...cache.CacheOption) (res T, err error)
GetCacheItem gets a typed value from cacheHandle with retry on transient errors. Cache misses are not retried and are normalized to cache.ErrCacheNotFound.
func NewCacheManager ¶
func NewCacheManager(redisCli *redis.Client, localCli cache.LocalStore, cfg cache.Config) (cache.CacheManager, error)
NewCacheManager creates a CacheManager backed by Redis, bigcache local cache, a local-on-Redis two-level cache, and a no-cache implementation. The caller keeps ownership of the Redis client and local cache.
func NewCacheOperation ¶
NewCacheOperation creates a typed cache operation wrapper over manager.
Types ¶
This section is empty.