Documentation
¶
Index ¶
- Variables
- type CacheManager
- func (cm *CacheManager[TInput, TOutput]) Delete(ctx context.Context, input TInput, dependencies ...map[string]any) error
- func (cm *CacheManager[TInput, TOutput]) Get(ctx context.Context, input TInput, dependencies ...map[string]any) (TOutput, error)
- func (cm *CacheManager[TInput, TOutput]) Refresh(ctx context.Context, input TInput, dependencies ...map[string]any) (TOutput, error)
- func (cm *CacheManager[TInput, TOutput]) Replace(ctx context.Context, input TInput, newValue TOutput, ...) (TOutput, error)
- type CacheOption
- func WithExpiration(expiration time.Duration) CacheOption
- func WithGzip() CacheOption
- func WithInMemoryCacheSize(inMemoryCacheSize int64) CacheOption
- func WithPrometheusNamespace(prometheusNamespace string) CacheOption
- func WithPrometheusPrefix(prometheusPrefix string) CacheOption
- func WithRedisConnection(redisConnection string) CacheOption
- func WithRedisPassword(redisPassword string) CacheOption
- func WithRedisTLS(redisTLS bool) CacheOption
- func WithSkipInMemoryCache() CacheOption
- type CacheSettings
- type GoCacheWrapper
Constants ¶
This section is empty.
Variables ¶
var ErrCacheMiss = errors.New("cache miss")
var ErrInvalidSingleFlightType = errors.New(
"invalid single flight type returned from refreshing the cache",
)
Functions ¶
This section is empty.
Types ¶
type CacheManager ¶
type CacheManager[TInput proto.Message, TOutput proto.Message] struct { // contains filtered or unexported fields }
func NewCacheManager ¶
type CacheOption ¶
type CacheOption func(*CacheSettings)
CacheOption is an interface for applying cache settings.
func WithExpiration ¶ added in v0.4.0
func WithExpiration(expiration time.Duration) CacheOption
func WithGzip ¶ added in v0.6.3
func WithGzip() CacheOption
WithGzip is a cache option for enable byte compression.
func WithInMemoryCacheSize ¶
func WithInMemoryCacheSize(inMemoryCacheSize int64) CacheOption
func WithPrometheusNamespace ¶ added in v0.6.2
func WithPrometheusNamespace(prometheusNamespace string) CacheOption
WithPrometheusNamespace is a cache option for setting the Prometheus namespace.
func WithPrometheusPrefix ¶
func WithPrometheusPrefix(prometheusPrefix string) CacheOption
WithPrometheusPrefix is a cache option for setting the Prometheus prefix.
func WithRedisConnection ¶
func WithRedisConnection(redisConnection string) CacheOption
WithRedisConnection is a cache option for setting the Redis connection string.
func WithRedisPassword ¶ added in v0.8.0
func WithRedisPassword(redisPassword string) CacheOption
WithRedisPassword is a cache option for setting the Redis password.
func WithRedisTLS ¶ added in v0.8.0
func WithRedisTLS(redisTLS bool) CacheOption
WithRedisTLS is a cache option for setting the Redis TLS.
func WithSkipInMemoryCache ¶
func WithSkipInMemoryCache() CacheOption
WithSkipInMemoryCache is a cache option for skipping the in-memory cache.
type CacheSettings ¶
type CacheSettings struct {
// contains filtered or unexported fields
}
CacheSettings contains the configuration for building a cache manager.
func DefaultCacheSettings ¶
func DefaultCacheSettings() *CacheSettings
DefaultCacheSettings returns the default cache settings.
type GoCacheWrapper ¶
type GoCacheWrapper struct {
// contains filtered or unexported fields
}
func NewGoCacheWrapper ¶
func NewGoCacheWrapper( prefix string, expiration time.Duration, settings *CacheSettings, ) (*GoCacheWrapper, error)
func (*GoCacheWrapper) Delete ¶ added in v0.6.0
func (gcw *GoCacheWrapper) Delete(ctx context.Context, key []byte) error