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: 1

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