A lightweight in-memory caching library for Node.js AWS Lambda functions. Version 1.0.0 provides a simple TTL-based cache that persists across invocations within the same execution context. Unlike generic caching solutions, it is tailored for stateless Lambda environments where memory is reused. The Cache class supports get, set, and TTL expiration. Ideal for reducing external API calls and improving performance in short-lived function invocations. No external dependencies.
npm install lambda-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: initialize cache, check for cached value, set value with TTL.
Design for eventual consistency; do not rely on cache being populated across different invocations.
Only use positive integers for TTL (e.g., 10 for 10 seconds).
Check for 'if (val === undefined)' or use 'if (!val)' but note falsey values like 0 or empty string are valid cached items.
Use ES module import: import { Cache } from 'lambda-cache' or import lambdaCache from 'lambda-cache'.Ensure correct import: import { Cache } from 'lambda-cache'.No dependency data recorded yet.