Registry / storage / cachefactory

cachefactory

JSON →
library3.0.0jsnpmunverified

A simple synchronous key-value cache for the browser that supports TTL-based expiration with aggressive deletion, localStorage persistence, and manual cache management. Version 3.0.0 is the latest stable release, last updated in 2017. Key differentiators: minimalistic API, synchronous operations, optional localStorage backing, and automatic expiration recycling. The package ships TypeScript types. Maintenance is low, with no recent updates.

storage
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.

ESM-only since v3

import { CacheFactory } from 'cachefactory'

Default import also works in TypeScript with esModuleInterop

import CacheFactory from 'cachefactory'

Cache is exported as a named interface/class for TypeScript types

import { Cache } from 'cachefactory'

Shows basic setup: creating a cache with expiration, storing/retrieving an object, and cleanup.

import { CacheFactory } from 'cachefactory'; const cacheFactory = new CacheFactory(); let cache; if (!cacheFactory.exists('my-cache')) { cache = cacheFactory.createCache('my-cache', { deleteOnExpire: 'aggressive', recycleFreq: 60000 }); } else { cache = cacheFactory.getCache('my-cache'); } cache.put('/books/1', { title: 'BookOne', id: 1 }); const book = cache.get('/books/1'); console.log(book); cache.remove('/books/1'); cacheFactory.destroy('my-cache');
Debug
Known footguns
deprecatedCacheFactory is no longer actively maintained. Last publish in 2017. Consider using lru-cache or quick-lru for newer projects.
gotchaUsing require('cachefactory') returns the module with default export? Actually, v3 is ESM-only; require will throw an error.
breakingVersion 3.0.0 removed support for CommonJS require. Only ES modules are supported.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
19 hits · last 30 days
bytedance
4
gptbot
3
amazonbot
3
ahrefsbot
1
Resources