Versions in this module Expand all Collapse all v1 v1.1.1 Sep 22, 2025 v1.1.0 Aug 26, 2025 Changes in this version + func HashAny(obj any) string + type Cache interface + Delete func(key K) error + Get func(key K) (v V, wasFound bool, err error) + GetOrSet func(key K, orSet func() (V, error)) (val V, wasFoundInCache bool, err error) + Purge func() error + Set func(key K, value V) error + func NewCache[K comparable, V any](backend CacheBackendAdapter[K, V], opts ...CacheOption[K, V]) Cache[K, V] + type CacheBackendAdapter interface + Delete func(key K) error + Get func(key K) (value V, wasFound bool, err error) + GetOrSet func(key K, orSet func() (V, error)) (val V, wasFoundInCache bool, err error) + Purge func() error + Set func(key K, value V) error + func NewInMemoryCache[K comparable, V any](ttl time.Duration, opts ...CacheBackendOption[K, V]) CacheBackendAdapter[K, V] + func NewRedisCache[K comparable, V any](ctx context.Context, client Redis, ttl time.Duration, ...) CacheBackendAdapter[K, V] + type CacheBackendOption func(cfg cacheBackendCfg[K, V]) cacheBackendCfg[K, V] + func IgnoreCacheSetErrors[K comparable, V any]() CacheBackendOption[K, V] + func WithCapacity[K comparable, V any](maxObjects uint64) CacheBackendOption[K, V] + func WithFailThroughCache[K comparable, V any](failThrough CacheBackendAdapter[K, V]) CacheBackendOption[K, V] + type CacheObserver interface + Delete func(k K) + Get func(k K) + Hit func(k K) + Miss func(k K) + Purge func() + Set func(k K) + type CacheOption func(cfg cacheCfg[K, V]) cacheCfg[K, V] + func WithObserver[K comparable, V any](observer CacheObserver[K]) CacheOption[K, V] + type CacheSetError struct + Message string + func (cse CacheSetError) Error() string + type EncryptedCache struct + func NewEncryptedCacheWithIterations[K comparable, V any](backend CacheBackendAdapter[K, []byte], salt []byte, iterations int, ...) (*EncryptedCache[K, V], error) + func NewEncryptedCacheWithPasswordNonce[K comparable, V any](backend CacheBackendAdapter[K, []byte], password, nonce, salt []byte, ...) (*EncryptedCache[K, V], error) + func NewEncryptedCache[K comparable, V any](backend CacheBackendAdapter[K, []byte], salt []byte, iterations int, ...) (*EncryptedCache[K, V], error) + func (c *EncryptedCache[K, V]) Delete(key K) error + func (c *EncryptedCache[K, V]) Get(key K) (v V, wasFound bool, err error) + func (c *EncryptedCache[K, V]) GetOrSet(key K, orSet func() (V, error)) (val V, wasFoundInCache bool, err error) + func (c *EncryptedCache[K, V]) Purge() error + func (c *EncryptedCache[K, V]) Set(key K, value V) error + type InMemoryCache struct + func (c *InMemoryCache[K, V]) Delete(key K) error + func (c *InMemoryCache[K, V]) Get(key K) (V, bool, error) + func (c *InMemoryCache[K, V]) GetOrSet(key K, orSet func() (V, error)) (val V, wasFoundInCache bool, err error) + func (c *InMemoryCache[K, V]) Purge() error + func (c *InMemoryCache[K, V]) Set(key K, val V) error + type Item interface + IsExpired func() bool + Value func() V + type Redis interface + Del func(ctx context.Context, keys ...string) *redis.IntCmd + FlushDB func(ctx context.Context) *redis.StatusCmd + Get func(ctx context.Context, key string) *redis.StringCmd + Set func(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd + type RedisCache struct + func (c *RedisCache[K, V]) Delete(key K) error + func (c *RedisCache[K, V]) Get(key K) (V, bool, error) + func (c *RedisCache[K, V]) GetOrSet(key K, orSet func() (V, error)) (val V, wasFoundInCache bool, err error) + func (c *RedisCache[K, V]) Purge() error + func (c *RedisCache[K, V]) Set(key K, val V) error Other modules containing this package github.com/zendesk/go-generics/cache