cache

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cache provides shared on-disk caching helpers for matcher implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](c *FileCache, key Key) (T, bool)

Get returns the cached value for key if it exists and has not expired.

func Set

func Set[T any](c *FileCache, key Key, value T) error

Set writes value to the cache under key.

Types

type FileCache

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

FileCache stores JSON-encoded values on disk with a TTL.

func NewFileCache

func NewFileCache(dir string, ttl time.Duration) (*FileCache, error)

NewFileCache creates a cache rooted at dir with the specified TTL.

type Key

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

Key uniquely identifies one cached auditor result.

func NewKey

func NewKey(purl, name, ecosystem, version string) Key

NewKey creates a stable cache key from the given fields. Callers should pass the most specific identity available.

Jump to

Keyboard shortcuts

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