config

package
v1.416.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEnabled

func IsEnabled(cfg *Config) bool

IsEnabled for cache.

Types

type Cache

type Cache interface {
	// Close the cache.
	Close(ctx context.Context) error

	// Remove a cached key.
	Remove(ctx context.Context, key string) error

	// Get a cached value.
	Get(ctx context.Context, key string, value any) error

	// Persist a value with key and TTL.
	Persist(ctx context.Context, key string, value any, ttl time.Duration) error
}

Cache allows marshaling and compressing items to the cache.

type Config

type Config struct {
	Options    map[string]any `yaml:"options,omitempty" json:"options,omitempty" toml:"options,omitempty"`
	Kind       string         `yaml:"kind,omitempty" json:"kind,omitempty" toml:"kind,omitempty"`
	Compressor string         `yaml:"compressor,omitempty" json:"compressor,omitempty" toml:"compressor,omitempty"`
	Encoder    string         `yaml:"encoder,omitempty" json:"encoder,omitempty" toml:"encoder,omitempty"`
}

Config for cache.

Jump to

Keyboard shortcuts

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