A minimal in-memory cache library for Node.js and the browser, supporting time-based expiration (TTL) policies. Version 0.4.0 provides a simple key-value store with configurable default expiration and per-item overrides, type definitions shipped, and zero dependencies. Designed for lightweight caching needs where full-featured solutions like lru-cache or node-cache are overkill, with a focus on a clean API and ease of use. Last updated in 2020, it is considered stable but in maintenance mode.
npm install simple-in-memory-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic cache operations: set, get, setEx with custom TTL, delete, clear, and size.
Consider migrating to actively maintained alternatives like lru-cache or node-cache.
If you need error handling, wrap the call in try/catch or check the return value.
Use `has` method or store null instead of undefined to differentiate.
Use import { createCache } from 'simple-in-memory-cache'Run npm install --save simple-in-memory-cache
Use setEx('key', 'value', secondsUntilExpiration)