{"id":44513,"library":"cachedown","title":"cachedown","description":"A leveldown implementation that wraps an underlying leveldown store with an LRU cache for improved get/put performance. Version 1.0.0 is the latest stable release. It proxies all leveldown methods while caching recently accessed key-value pairs. Key differentiators: simple drop-in replacement for leveldown in levelup; supports configurable cache size and manual cache clearing. Requires leveldown as a peer dependency.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install cachedown","lang":"bash","label":"npm"},{"cmd":"yarn add cachedown","lang":"bash","label":"yarn"},{"cmd":"pnpm add cachedown","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; needed as the underlying storage engine","package":"leveldown","optional":false}],"imports":[{"note":"ESM default import; CJS require works but ESM is recommended now.","wrong":"const cachedown = require('cachedown')","symbol":"default","correct":"import cachedown from 'cachedown'"},{"note":"Named export is not available; use default import then method.","wrong":"const { setLeveldown } = require('cachedown')","symbol":"cachedown.setLeveldown","correct":"import cachedown from 'cachedown'; cachedown.setLeveldown(leveldown)"},{"note":"Second argument (underlying leveldown) is required unless setLeveldown was called first.","wrong":"const db = new cachedown(location)","symbol":"cachedown instance","correct":"import cachedown from 'cachedown'; const db = new cachedown(location, underlyingLeveldown)"}],"quickstart":{"code":"import levelup from 'levelup';\nimport leveldown from 'leveldown';\nimport cachedown from 'cachedown';\n\ncachedown.setLeveldown(leveldown);\nconst db = levelup('./mydb', { db: cachedown });\n\nawait db.put('key', 'value');\nconst val = await db.get('key');\nconsole.log(val); // 'value'","lang":"typescript","description":"Shows setting default leveldown, creating levelup with cachedown, and basic put/get operations."},"warnings":[{"fix":"Set max size via instance.maxSize(number) or constructor options.","message":"Default cache max size is Infinity. If not manually limited, cache will grow unbounded.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass leveldown as second argument: new cachedown(location, leveldown) or use setLeveldown() beforehand.","message":"In v1.0.0, the constructor signature changed to require the underlying leveldown instance as second argument (unless setLeveldown was called).","severity":"breaking","affected_versions":"=1.0.0"},{"fix":"No fix needed; it's by design. Ensure critical data is always read from underlying store after restart.","message":"Cache is not persisted; process restart loses cached data but underlying store remains.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':20 'access':34 'cach':14,32,52,56 'cachedown':1 'clear':57 'configur':51 'depend':63 'differenti':40 'drop':43 'drop-in':42 'get/put':17 'implement':4 'improv':16 'javascript':64 'key':36,39 'key-valu':35 'latest':23 'leveldown':3,9,29,47,59 'levelup':49 'lru':13 'manual':55 'method':30 'pair':38 'peer':62 'perform':18 'proxi':27 'recent':33 'releas':25 'replac':45 'requir':58 'simpl':41 'size':53 'stabl':24 'store':10 'support':50 'under':8 'valu':37 'version':19 'wrap':6","created_at":"2026-06-07T12:50:30.666972+00:00","updated_at":"2026-06-07T12:50:30.666972+00:00","problems":[{"fix":"Use 'new cachedown(location, leveldown)' or ensure default import is correct.","cause":"Missing 'new' keyword or incorrect import/require","error":"TypeError: cachedown is not a constructor"},{"fix":"Install leveldown: npm install leveldown; then pass as second argument or call setLeveldown.","cause":"Missing leveldown peer dependency or not passed/injected","error":"Error: leveldown not found"},{"fix":"Ensure you are not using cachedown as the underlying leveldown instance; pass the original leveldown.","cause":"Infinite recursion when overwriting methods incorrectly or circular dependency","error":"RangeError: Maximum call stack size exceeded"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"cachedown","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"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}}