An LRU (least recently used) cache plugin for PouchDB designed to store binary data (Blobs/Buffers) with a configurable maximum size limit. Current stable version is 1.1.4, with infrequent releases. It uses PouchDB's attachment API for storage, providing cross-browser support (IE 10+, modern browsers, Node.js). Key differentiators: leverage PouchDB's battle-tested binary storage, automatic eviction of least recently used items when size limit is exceeded, and simple API similar to node-lru-cache. Good for caching images or other binary assets in offline-first webapps.
npm install pouchdb-lru-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import, initialize the LRU cache, store a Blob, retrieve it, and delete it.
Call db.initLru() immediately after creating the database.
Set maxSize lower than your actual storage budget to account for overhead (e.g., 80% of available space).
Use npm and import/require. For modern PouchDB, consider alternative caching strategies or test thoroughly.
Ensure db.initLru(maxSize) is called after creating the database.
Call PouchDB.plugin(require('pouchdb-lru-cache')) or the equivalent import.Use await or .then() properly; avoid calling lru methods after db.close() or db.destroy().