fscache

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: Apache-2.0 Imports: 8 Imported by: 2 modules, 1 package

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 fscache implements a file system-based store.Cache.

Entries are stored as files in a directory under the user's OS cache directory by default. The cache location is configured via URL; see Open for details.

Users should call [fsCache.Close] on the cache when done to release resources promptly.

Index

Constants

View Source
const Scheme = "fscache" // url scheme for the file system cache

Variables

View Source
var (
	ErrUserCacheDir   = errors.New("fscache: could not determine user cache dir")
	ErrMissingAppName = errors.New("fscache: appname query parameter is required")
	ErrCreateCacheDir = errors.New("fscache: could not create cache dir")
)

Functions

func Open

func Open(u *url.URL) (*fsCache, error)

Open creates a new file system cache from the provided URL.

The URL path sets the base directory (defaults to the user's OS cache dir if empty). The "appname" query parameter is required and specifies a subdirectory.

Examples:

fscache://?appname=myapp           → <user cache dir>/myapp
fscache:///tmp/cache?appname=myapp → /tmp/cache/myapp

Types

This section is empty.

Jump to

Keyboard shortcuts

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