cache

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cache stores scan results keyed by content hash so unchanged targets are not re-scanned. Keys come from plugin.ComputeCacheKey (a hex SHA, safe as a filename).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Get returns the cached report for key, or ok=false on miss/expiry.
	Get(key string) (sarif.Report, bool)
	// Put stores report under key.
	Put(key string, report sarif.Report) error
}

Cache stores and retrieves scan reports by key.

type Local

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

Local is a filesystem-backed cache with optional TTL expiry. Safe for concurrent use.

func NewLocal

func NewLocal(dir string, ttl time.Duration) *Local

NewLocal returns a cache storing entries under dir. A ttl of 0 disables expiry.

func (*Local) Get

func (l *Local) Get(key string) (sarif.Report, bool)

Get returns the cached report for key, missing on absence, unreadable data, or expiry.

func (*Local) Put

func (l *Local) Put(key string, report sarif.Report) error

Put stores report under key with the current timestamp.

type Memory

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

Memory is a process-lifetime in-memory cache (no TTL). Safe for concurrent use.

func NewMemory

func NewMemory() *Memory

NewMemory returns an empty in-memory cache.

func (*Memory) Get

func (c *Memory) Get(key string) (sarif.Report, bool)

Get returns the cached report for key.

func (*Memory) Put

func (c *Memory) Put(key string, report sarif.Report) error

Put stores report under key.

type Noop

type Noop struct{}

Noop is a cache that stores nothing and always misses.

func (Noop) Get

func (Noop) Get(string) (sarif.Report, bool)

Get always misses.

func (Noop) Put

func (Noop) Put(string, sarif.Report) error

Put discards the report.

Jump to

Keyboard shortcuts

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