cache

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2022-2026 Reto Gantenbein SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	// Local file system base path for storing cached files
	BasePath string

	// List of file suffixes that will be cached
	FileSuffixes []string
}

type FileCache

type FileCache interface {
	// Remove cached file for given URL
	DeleteFile(string) error

	// Return file system path to cached file for given URL. If the URL points
	// to a path outside the cache directory return an error.
	GetFilePath(string) (string, error)

	// Returns a list of file suffixes that will be cached
	GetFileSuffixes() []string

	// Return if URL is supposed to be cached
	IsCacheCandidate(string) bool

	// Return if file exists in cache for given URL
	IsCached(string) bool

	// Save buffer as file in cache for given URL
	SaveToDisk(string, *bytes.Buffer, time.Time) error
}

func New

func New(cfg *CacheConfig) FileCache

Jump to

Keyboard shortcuts

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