cache

package
v0.0.0-...-2bc8f10 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Handles caching of HTTP responses

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskCache

type DiskCache struct {
	// contains filtered or unexported fields
}

DiskCache implements Cache interface for disk-based caching

func (*DiskCache) Get

func (d *DiskCache) Get(cacheKey string) ([]byte, error)

func (*DiskCache) Init

func (d *DiskCache) Init() error

Init ensures the cache directory exists

func (*DiskCache) Set

func (d *DiskCache) Set(cacheKey string, data []byte) error

Set stores a response in the cache

type GenericCache

type GenericCache interface {
	// retrieves cached response data if it exists and is not expired.
	// returns nil, nil when not found or expired
	Get(key string) ([]byte, error)
	// stores response data in the cache at the specified path
	Set(key string, value []byte) error
	// initializes the cache (e.g., creates necessary directories)
	Init() error
}

GenericCache interface for caching operations

func NewGenericDisk

func NewGenericDisk(cacheDir string, ttl time.Duration) GenericCache

NewGenericDisk creates a new disk cache

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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