A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pkg.go.dev/github.com/bartventer/httpcache/store/fscache below:

fscache package - github.com/bartventer/httpcache/store/fscache - Go Packages

Package fscache implements a file system-based cache backend.

Entries are stored as files in a directory under the user's OS cache directory by default. The cache location and behavior are configured via DSN query parameters.

Supported DSN query parameters:

Example DSNs:

fscache://?appname=myapp
fscache:///tmp/cache?appname=myapp&timeout=2s
fscache:///tmp/cache?appname=myapp&connect_timeout=2s&timeout=1m
fscache://?appname=myapp&encrypt=on&encrypt_key=6S-Ks2YYOW0xMvTzKSv6QD30gZeOi1c6Ydr-As5csWk=

Example environment variable:

export FSCACHE_ENCRYPT_KEY="6S-Ks2YYOW0xMvTzKSv6QD30gZeOi1c6Ydr-As5csWk="

To generate a suitable encryption key (32 bytes, URL-safe, with padding):

openssl rand 32 | base64 | tr '+/' '-_' | tr -d '\n'
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")
)

Open creates a new file system cache with the specified application name and options.

See the package documentation for supported options and examples.

type Option interface {
	
}

WithBaseDir sets the base directory for the cache; default: user's OS cache directory.

WithConnectTimeout sets the timeout for establishing the cache connection; default: 5 minutes.

WithEncryption enables encryption for cache entries using AES-GCM.

WithTimeout sets the timeout for cache operations; default: 5 minutes.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4