cache

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeFilePath added in v0.16.0

func NormalizeFilePath(fileName string, keepSlashes bool) string

Types

type Cache added in v0.16.0

type Cache[T any] interface {
	Get(cacheIdentifier string) (T, bool, error)
	Set(cacheIdentifier string, objectToCache T, ttl time.Duration) error
	Clear(cacheIdentifier string) error
}

type FileCache added in v0.16.0

type FileCache[T any] struct {
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewFileCache added in v0.16.0

func NewFileCache[T any](cacheDir string, logger *slog.Logger) *FileCache[T]

func (*FileCache[T]) Clear added in v0.16.0

func (c *FileCache[T]) Clear(cacheIdentifier string) error

func (*FileCache[T]) Get added in v0.16.0

func (c *FileCache[T]) Get(cacheIdentifier string) (T, bool, error)

func (*FileCache[T]) Set added in v0.16.0

func (c *FileCache[T]) Set(cacheIdentifier string, objectToCache T, ttl time.Duration) error

type MemoryCache added in v0.16.0

type MemoryCache[T any] struct {
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewMemoryCache added in v0.16.0

func NewMemoryCache[T any](logger *slog.Logger) *MemoryCache[T]

func (*MemoryCache[T]) Clear added in v0.16.0

func (c *MemoryCache[T]) Clear(cacheIdentifier string) error

func (*MemoryCache[T]) Get added in v0.16.0

func (c *MemoryCache[T]) Get(cacheIdentifier string) (T, bool, error)

func (*MemoryCache[T]) Set added in v0.16.0

func (c *MemoryCache[T]) Set(cacheIdentifier string, objectToCache T, ttl time.Duration) error

Jump to

Keyboard shortcuts

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