cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

internal/cache/ttl.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) ([]byte, bool)
	Set(key string, value []byte, ttl time.Duration)
}

func NewComposite

func NewComposite(cfg Config) Cache

func NewFile

func NewFile(dir string, ttl time.Duration) Cache

func NewMemory

func NewMemory(max int, ttl time.Duration) Cache

func NewRedis

func NewRedis(addr string, ttl time.Duration) Cache

type Config

type Config struct {
	MemoryEnabled bool
	MemoryTTL     time.Duration
	MemoryMax     int

	FileEnabled   bool
	FileTTL       time.Duration
	FileDirectory string

	RedisEnabled bool
	RedisTTL     time.Duration
	RedisAddress string

	Logger log.Logger
}

Jump to

Keyboard shortcuts

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