cachemanager

package
v0.0.0-...-3603042 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package cachemanager provides typed cache operations and the concrete CacheManager implementation.

Index

Constants

This section is empty.

Variables

View Source
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

func NewCacheOperation[T any](manager cache.CacheManager) (cache.Cache[T], error)

NewCacheOperation creates a typed cache operation wrapper over manager.

func SaveCacheItem

func SaveCacheItem[T any](ctx context.Context, cacheHandle cache.Cache[T], key string, value T, expiration time.Duration, optFns ...cache.CacheOption) (err error)

SaveCacheItem saves value into cacheHandle with retry on any save error.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL