{"id":44514,"library":"cachefactory","title":"CacheFactory","description":"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.","status":"maintenance","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/jmdobry/CacheFactory","tags":["javascript","cache","typescript"],"install":[{"cmd":"npm install cachefactory","lang":"bash","label":"npm"},{"cmd":"yarn add cachefactory","lang":"bash","label":"yarn"},{"cmd":"pnpm add cachefactory","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v3","wrong":"const CacheFactory = require('cachefactory')","symbol":"CacheFactory","correct":"import { CacheFactory } from 'cachefactory'"},{"note":"Default import also works in TypeScript with esModuleInterop","wrong":"const CacheFactory = require('cachefactory'); const cacheFactory = new CacheFactory()","symbol":"CacheFactory","correct":"import CacheFactory from 'cachefactory'"},{"note":"Cache is exported as a named interface/class for TypeScript types","wrong":"import { CacheFactory } from 'cachefactory'; const cache = new Cache()","symbol":"Cache","correct":"import { Cache } from 'cachefactory'"}],"quickstart":{"code":"import { CacheFactory } from 'cachefactory';\n\nconst cacheFactory = new CacheFactory();\nlet cache;\n\nif (!cacheFactory.exists('my-cache')) {\n  cache = cacheFactory.createCache('my-cache', {\n    deleteOnExpire: 'aggressive',\n    recycleFreq: 60000\n  });\n} else {\n  cache = cacheFactory.getCache('my-cache');\n}\n\ncache.put('/books/1', { title: 'BookOne', id: 1 });\nconst book = cache.get('/books/1');\nconsole.log(book);\n\ncache.remove('/books/1');\ncacheFactory.destroy('my-cache');","lang":"typescript","description":"Shows basic setup: creating a cache with expiration, storing/retrieving an object, and cleanup."},"warnings":[{"fix":"Migrate to a maintained library like lru-cache.","message":"CacheFactory is no longer actively maintained. Last publish in 2017. Consider using lru-cache or quick-lru for newer projects.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Use import syntax or enable esModuleInterop in TypeScript and use default import.","message":"Using require('cachefactory') returns the module with default export? Actually, v3 is ESM-only; require will throw an error.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Update imports to ES module syntax.","message":"Version 3.0.0 removed support for CommonJS require. Only ES modules are supported.","severity":"breaking","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'2017':37 '3.0.0':28 'aggress':19 'api':41 'automat':48 'back':46 'base':16 'browser':11 'cach':8,25,64 'cachefactori':1 'delet':20 'differenti':39 'expir':17,49 'javascript':63 'key':6,38 'key-valu':5 'last':34 'latest':31 'localstorag':21,45 'low':58 'mainten':56 'manag':26 'manual':24 'minimalist':40 'oper':43 'option':44 'packag':52 'persist':22 'recent':61 'recycl':50 'releas':33 'ship':53 'simpl':3 'stabl':32 'support':13 'synchron':4,42 'ttl':15 'ttl-base':14 'type':55 'typescript':54,65 'updat':35,62 'valu':7 'version':27","created_at":"2026-06-07T12:50:30.762684+00:00","updated_at":"2026-06-07T12:50:30.762684+00:00","problems":[{"fix":"Use import syntax: import { CacheFactory } from 'cachefactory'; or enable ESM in your project.","cause":"Trying to use require() with an ES module package.","error":"ERR_REQUIRE_ESM: require() of ES Module"},{"fix":"Run npm install cachefactory --save","cause":"Package not installed or incorrect path.","error":"Cannot find module 'cachefactory'"},{"fix":"Ensure you import { CacheFactory } from 'cachefactory' and instantiate: new CacheFactory()","cause":"Importing default export incorrectly (e.g., using CacheFactory from default export without new).","error":"TypeError: cacheFactory.createCache is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jmdobry/CacheFactory","github":"https://github.com/jmdobry/CacheFactory","docs":null,"changelog":null,"pypi":null,"npm":"cachefactory","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}