{"id":44468,"library":"cache-conf","title":"cache-conf","description":"Simple cache config handling for your app or module. Version 0.6.0 is the latest stable release (last updated in 2018). It extends the `conf` package to add caching capabilities: supports maxAge (TTL) per key, version-based invalidation, and expiration checks. Use when you need persistent configuration with automatic cache expiry. Not actively maintained; consider alternatives like `conf` with manual caching or updated packages.","status":"maintenance","version":"0.6.0","language":"javascript","source_language":"en","source_url":"https://github.com/samverschueren/cache-conf","tags":["javascript","cache","caching","config","store","app","storage","conf","configuration"],"install":[{"cmd":"npm install cache-conf","lang":"bash","label":"npm"},{"cmd":"yarn add cache-conf","lang":"bash","label":"yarn"},{"cmd":"pnpm add cache-conf","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"extends Conf for non-cached config handling; mandatory dependency","package":"conf","optional":false},{"reason":"used in example for async waits; not a runtime dependency","package":"delay","optional":true}],"imports":[{"note":"CommonJS only; no default ESM export. For TypeScript use `import CacheConf = require('cache-conf')` or use the `esModuleInterop` flag with `import CacheConf from 'cache-conf'`.","wrong":"import CacheConf from 'cache-conf'","symbol":"CacheConf","correct":"const CacheConf = require('cache-conf')"},{"note":"Instantiated without `new` throws TypeError: Class constructor CacheConf cannot be invoked without 'new'.","wrong":"","symbol":"CacheConf class","correct":"const config = new CacheConf()"},{"note":"Methods are instance methods, not static. `set` with object sets multiple keys; options are per-key.","wrong":"CacheConf.get('key')","symbol":"Instance methods: get, set, isExpired","correct":"config.get('key', { ignoreMaxAge: true }); config.set('key', val, { maxAge: 1000 }); config.isExpired('key')"},{"note":"When setting an object, options apply to all keys. Version option is for single key. Use nested set calls for per-key options.","wrong":"config.set({a:1, b:2}, {version: '1'})","symbol":"options for set/get","correct":"config.set({a:1, b:2}, {maxAge: 10000})"}],"quickstart":{"code":"const CacheConf = require('cache-conf');\nconst config = new CacheConf();\n\n// Set with 5 second expiry\nconfig.set('unicorn', '🦄', { maxAge: 5000 });\nconsole.log(config.get('unicorn'));\n//=> '🦄'\n\n// Wait 5 seconds (use delay in async function)\nsetTimeout(() => {\n  console.log(config.get('unicorn'));\n  //=> undefined (expired)\n}, 5000);\n\n// Force get even if expired\nconsole.log(config.get('unicorn', { ignoreMaxAge: true }));\n//=> '🦄'\n\n// Check expiry without retrieving\nconsole.log(config.isExpired('unicorn'));\n//=> false (before timeout) or true (after)\n","lang":"javascript","description":"Shows basic usage: setting a key with maxAge, retrieving before and after expiry, using ignoreMaxAge, and checking expiration with isExpired."},"warnings":[{"fix":"Use `const CacheConf = require('cache-conf');` or for TypeScript, use `import CacheConf = require('cache-conf');`.","message":"CommonJS-only module; no ES module export. Using `import CacheConf from 'cache-conf'` fails.","severity":"gotcha","affected_versions":">=0.6.0"},{"fix":"Consider migrating to `conf` and implementing your own caching, or use a maintained alternative.","message":"Package is in maintenance mode; last release in 2018. No updates for security or Node.js versions.","severity":"deprecated","affected_versions":">=0.6.0"},{"fix":"Set keys individually with separate options if different maxAge per key is needed.","message":"When setting multiple keys via object, options like `maxAge` apply to all keys at once, not individually.","severity":"gotcha","affected_versions":">=0.6.0"},{"fix":"Use individual `set` calls for keys that need version differentiation.","message":"`set` with an object doesn't allow per-key version; version option is only for single key sets.","severity":"gotcha","affected_versions":">=0.6.0"}],"env_vars":null,"search_vec":"'0.6.0':14 '2018':23 'activ':56 'add':30 'altern':59 'app':10,73 'automat':52 'base':40 'cach':2,5,31,53,64,69,70 'cache-conf':1 'capabl':32 'check':44 'conf':3,27,61,75 'config':6,71 'configur':50,76 'consid':58 'expir':43 'expiri':54 'extend':25 'handl':7 'invalid':41 'javascript':68 'key':37 'last':20 'latest':17 'like':60 'maintain':57 'manual':63 'maxag':34 'modul':12 'need':48 'packag':28,67 'per':36 'persist':49 'releas':19 'simpl':4 'stabl':18 'storag':74 'store':72 'support':33 'ttl':35 'updat':21,66 'use':45 'version':13,39 'version-bas':38","created_at":"2026-06-07T12:50:17.171622+00:00","updated_at":"2026-06-07T12:50:17.171622+00:00","problems":[{"fix":"Use `new CacheConf()` or `new (require('cache-conf'))()`","cause":"Used `CacheConf()` without `new`","error":"TypeError: Class constructor CacheConf cannot be invoked without 'new'"},{"fix":"Use CommonJS require, or configure bundler to handle CommonJS. For TypeScript: `import CacheConf = require('cache-conf')`","cause":"Tried to `import CacheConf from 'cache-conf'` in ESM context","error":"TypeError: CacheConf is not a constructor"},{"fix":"Switch to CommonJS `require` or use a transpiler/polyfill.","cause":"Attempting to import as ES module (package has only CommonJS)","error":"SyntaxError: Unexpected token 'export'"}],"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/samverschueren/cache-conf#readme","github":"https://github.com/samverschueren/cache-conf","docs":null,"changelog":null,"pypi":null,"npm":"cache-conf","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}}