config

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderMemory is the memory provider.
	ProviderMemory = "memory"
	// ProviderRedis is the redis provider.
	ProviderRedis = "redis"
)

Variables

This section is empty.

Functions

func ProvideCache

func ProvideCache[T any](cfg *Config, logger logging.Logger, tracerProvider tracing.TracerProvider, metricsProvider metrics.Provider) (cache.Cache[T], error)

ProvideCache provides a Cache.

Types

type Config

type Config struct {
	Redis    *redis.Config `env:"init"     envPrefix:"REDIS_" json:"redis"`
	Provider string        `env:"PROVIDER" json:"provider"`
	Expiry   time.Duration `env:"EXPIRY"   envDefault:"1h"    json:"expiry"`
}

Config is the configuration for the cache.

func (*Config) ValidateWithContext

func (cfg *Config) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a Config struct.

Jump to

Keyboard shortcuts

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