Configurable cache support for memoized functions, providing base-cache prototype, in-memory RAM cache (cache-ram), and no-cache mock for testing. Current stable version is 6.0.5, with irregular release cadence. Supports LRU eviction, TTL (maxAge), stale-while-revalidate (maxValidity), tag-based invalidation, custom serialization/deserialization, and custom key extraction. Designed to integrate with async-deco and has adapters for cache-manager and Redis via companion packages. Suitable for both Node.js and browser environments.
npm install memoize-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows initialization with custom key extraction from first argument, LRU limit, TTL, then pushing and querying cached values.
Ensure getKey receives the full args array: getKey: (args) => args[0].id.
Pass values in milliseconds: maxAge: 20000 for 20 seconds.
Continue using milliseconds; upcoming major may change to seconds.
Use main import and destructure: import { CacheRAM } from 'memoize-cache'.Use const { CacheRAM } = require('memoize-cache');Change to: import { CacheRAM } from 'memoize-cache';Ensure getKey is a function that takes args: getKey: (args) => args[0].id
Use require('memoize-cache') and destructure CacheRAM.No dependency data recorded yet.