cache

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache provides a SQLite-backed cache for CVE query results. Reduces API load on NVD/OSV/GHSA and speeds up repeat scans.

func New

func New(cacheDir string, ttlHours int) (*Cache, error)

New creates a cache backed by SQLite at the given directory. ttlHours controls how long entries remain valid.

func (*Cache) Close

func (c *Cache) Close() error

Close closes the cache database.

func (*Cache) Get

func (c *Cache) Get(key string, dest interface{}) bool

Get retrieves a cached value by key. Returns nil if not found or expired.

func (*Cache) Prune

func (c *Cache) Prune()

Prune removes all expired entries.

func (*Cache) Put

func (c *Cache) Put(key string, value interface{}) error

Put stores a value in the cache with the configured TTL.

Jump to

Keyboard shortcuts

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