safe-memory-cache

JSON →
library 3.0.0 ·javascript
verified Jun 7, 2026

A lightweight, secure in-memory cache library for Node.js and browsers, currently at version 3.0.0. It limits the number of stored items without using JavaScript's `delete` operator to avoid memory leaks and hidden class changes, and instead uses a bucket-based eviction strategy that removes the oldest bucket when full. It is immune to prototype poisoning attacks via malicious keys like `__proto__` and avoids individual timeout timers per cached item. Main differentiators include defensive coding against prototype pollution, gradual memory freeing, and minimal overhead.