cachai is an LRU cache for Node.js, forked from jscache and loosely based on ASP.NET's Cache. Version 1.0.2 is the latest stable release, though the package appears to be in maintenance mode with no recent updates. It provides caching options including absolute expiration, sliding expiration, priority, and a purge callback. Compared to alternatives like lru-cache or node-cache, it offers a more feature-rich API inspired by ASP.NET, but lacks modern ESM support and TypeScript typings.
npm install cachaiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: create a cache with max size, set/get items with sliding expiration and priority, retrieve stats, remove items, and clear.
Migrate to a maintained alternative like lru-cache (npm install lru-cache).
Use setItem (add), getItem (retrieve), removeItem (delete).
Always pass a Date: { expirationAbsolute: new Date('2025-12-31') }Use Cache.Priority.LOW, Cache.Priority.NORMAL, Cache.Priority.HIGH.
Use cache.size() with parentheses.
Use cache.setItem(key, value, options).
Use cache.size()
Use const Cache = require('cachai');No dependency data recorded yet.