filecache

package
v4.23.7 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

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 filecache holds the on-disk caches that let a scan skip work on files whose text has not changed: the SAST result cache and the graph facts cache.

A cache is one JSON document per scanned directory and key, at <dir>/<sha256(root)[:16]>/<key>.json. The key names everything the cached results depend on besides the files themselves (the CLI build, the rules); each entry inside names the file text it was computed from. The caches are a convenience: a document that cannot be read is empty, and one that cannot be written is skipped, never an error.

Index

Constants

View Source
const Keep = 8

Keep is how many documents (keys) are kept per scanned directory; older ones are removed when a new one is written. Each rule set is its own key, and scan, sast, secrets, iac and containers each evaluate a different one, so fewer than five meant running them in turn over one tree evicted every cache before it was read again.

Variables

This section is empty.

Functions

func ContentSHA

func ContentSHA(text []byte) string

ContentSHA is the hex SHA-256 of a file's text, the identity an entry is checked against.

func Path

func Path(dir, root, key string) string

Path is the document for the scan root and key under dir.

func Prune

func Prune(dir string, keep int)

Prune keeps the newest keep documents in dir.

func Write

func Write(path string, data []byte)

Write replaces the document at path atomically, then removes that directory's documents beyond the newest Keep. It reports nothing: a cache that could not be written is a slower next run, not a failed one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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