Disk-based caching layer for NodeSecure analysis payloads, with manifest tracking, MRU ordering, and integrity verification.
๐ง Requirements
- Node.js v24 or higher
๐ Getting Started
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
$ npm i @nodesecure/cache
# or
$ yarn add @nodesecure/cache๐ก Features
- ๐พ Persists analysis payloads to disk with integrity tracking and a manifest of available specs.
- ๐ Looks up cached payloads by package spec (
name@version) or integrity hash. - ๐ Iterates payloads in Most Recently Used (MRU) order, tracking the currently active payload.
๐ Usage example
import { PayloadCache } from "@nodesecure/cache"; const cache = new PayloadCache(); await cache.load(); // Save a payload (returned from @nodesecure/scanner) await cache.save( payload, { useAsCurrent: true, scanType: "from" } ); const found = await cache.findBySpec("express@4.18.2"); // Iterate all cached payloads in MRU order for (const metadata of cache) { console.log(metadata.spec, metadata.lastUsedAt); } await cache.remove("express@4.18.2"); // Clear the entire cache await cache.clear();