config

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 8 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) (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