filecache

package
v0.1.2-iss62-1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package filecache provides a file cache

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoCachedKey is returned when there is no cached key available.
	ErrNoCachedKey = errors.New("no cached key")
)

Functions

This section is empty.

Types

type FileCache

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

FileCache provides a simple file-based cache implementation.

func New

func New(
	cacheDir string,
	prefix string,
	filesystem afero.Fs,
) *FileCache

New creates a new FileCache instance.

func (*FileCache) Delete

func (fc *FileCache) Delete(key string) error

Delete removes the cache entry for a given key.

func (*FileCache) Get

func (fc *FileCache) Get(key string) ([]byte, error)

Get retrieves data from the cache for a given key.

func (*FileCache) GetFilename

func (fc *FileCache) GetFilename(id string) string

GetFilename constructs the full path for a given cache key.

func (*FileCache) Set

func (fc *FileCache) Set(key string, data []byte) error

Set stores data in the cache for a given key.

Jump to

Keyboard shortcuts

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