filecache

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package filecache provides an implementation of prototransform.Cache that is based on the file system. Cached data is stored in and loaded from files, with cache keys being used to form the file names.

This is the simplest form of caching when sharing cache results is not needed and the workload has a persistent volume (e.g. if the application restarts, it will still have access to the same cache files written before it restarted).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) (prototransform.Cache, error)

New creates a new file-system-backed cache with the given configuration.

Types

type Config

type Config struct {
	// Required: the folder in which cached files live.
	Path string
	// Defaults to "cache_" if left empty. This is added to the
	// cache key and the extension below to form a file name.
	// A trailing underscore is not necessary and will be added
	// if not present (to separate prefix from the rest of the
	// cache key).
	FilenamePrefix string
	// Defaults to ".bin" if left empty. This is added to the
	// cache key and prefix above to form a file name.
	FilenameExtension string
	// The mode to use when creating new files in the cache
	// directory. Defaults to 0600 if left zero. If not left
	// as default, the mode must have at least bits 0400 and
	// 0200 (read and write permissions for owner) set.
	FileMode fs.FileMode
}

Config represents the configuration parameters used to create a new file-system-backed cache.

Jump to

Keyboard shortcuts

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