Registry / storage / feather-cache-indexeddb

feather-cache-indexeddb

JSON →
library1.0.3jsnpmunverified

IndexedDB driver for feather-cache storage. Current stable version 1.0.3 provides a factory function idbFeatherCacheDriver(maxAgeInMs) that returns a storage driver compatible with FeatherCache. Requires feather-cache ^1.x.x. Built with TypeScript, ships types. The driver uses IndexedDB via idb-keyval under the hood. Release cadence is low; package is stable with infrequent updates. Differentiator: enables persistent client-side caching via IndexedDB with TTL support, unlike in-memory or localStorage alternatives.

npm install feather-cache-indexeddb
INSTALL
IMPORT
SIG · FEATHER-CACHE-INDE
F
feather-cache-indexeddb
storagejavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

idbFeatherCacheDriver
import { idbFeatherCacheDriver } from 'feather-cache-indexeddb'
const idbFeatherCacheDriver = require('feather-cache-indexeddb')
ESM default index exports a named export. CommonJS require will get an object with the named export, not the function directly.
FeatherCache
import { FeatherCache } from 'feather-cache'
import { FeaterCache } from 'feather-cache'
FeatherCache is from the peer dependency feather-cache, not this package.

Initializes a FeatherCache instance with IndexedDB driver and demonstrates setting and getting a value.

import { FeatherCache } from 'feather-cache'; import { idbFeatherCacheDriver } from 'feather-cache-indexeddb'; const cache = new FeatherCache(idbFeatherCacheDriver(60 * 1000 * 5)); // 5 min TTL await cache.set('key', { data: 'value' }); const result = await cache.get('key'); console.log(result); // { data: 'value' }
Debug
Known issues
gotchaRequires browser environment with IndexedDB support. Will throw in Node.js or environments without IndexedDB.
fix
Use a different driver (e.g., in-memory) for server-side code or polyfill IndexedDB.
affects: >=1.0.0
gotchaidbFeatherCacheDriver returns a driver object, not a FeatherCache instance. Must be passed to FeatherCache constructor.
fix
new FeatherCache(idbFeatherCacheDriver(...)) instead of using the driver directly.
affects: >=1.0.0
gotchamaxAgeInMs parameter uses milliseconds; default 5 minutes (300000 ms). Passing wrong unit (seconds) will cause unexpected expiration.
fix
Pass maxAge in milliseconds, e.g., idbFeatherCacheDriver(300000) for 5 minutes.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: idbFeatherCacheDriver is not a function
Using default import instead of named import, or CommonJS require without destructuring.
fix
Use named import: import { idbFeatherCacheDriver } from 'feather-cache-indexeddb' or const { idbFeatherCacheDriver } = require('feather-cache-indexeddb').
Error: IndexedDB is not available in this environment.
Running in Node.js or a non-browser environment without IndexedDB.
fix
Use a different driver for server-side code, or polyfill IndexedDB with libraries like fake-indexeddb.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
feather-cacherequiredpeer dependency; the core caching library that this driver is designed to work with
Agent activity
24 hits · last 30 days
node
22
Resources
feather-cache-indexeddb — npm install feather-cache-indexeddb · libregistry