buildcache

package
v0.35.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CreateDirErr error occurred when creating the cache directory
	CreateDirErr = cacheError{Code: createDirErrCode}
	// FileWriteErr error occurred when writing the placeholder file
	FileWriteErr = cacheError{Code: fileWriteErrCode}
)

Functions

This section is empty.

Types

type BuildCache

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

BuildCache represents a cache of built files (sketches and cores), it's designed to work on directories. Given a directory as "base" it handles direct subdirectories as keys

func New

func New(baseDir *paths.Path) *BuildCache

New instantiates a build cache

func (*BuildCache) GetOrCreate

func (bc *BuildCache) GetOrCreate(key string) (*paths.Path, error)

GetOrCreate retrieves or creates the cache directory at the given path If the cache already exists the lifetime of the cache is extended.

func (*BuildCache) Purge

func (bc *BuildCache) Purge(ttl time.Duration)

Purge removes all cache directories within baseDir that have expired To know how long ago a directory has been last used it checks into the .last-used file.

Jump to

Keyboard shortcuts

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