{"id":42483,"library":"cacheman","title":"Cacheman","description":"A small and efficient cache provider for Node.js that supports in-memory, file, Redis, and MongoDB engines. Version 2.2.1 allows flexible configuration with TTL, custom delimiters, and Promise support. It provides a simple unified API (set, get, del, clear) with both callback and Promise interfaces. Unlike single-engine caches, cacheman lets you switch engines without changing application code, making it ideal for development vs production environments.","status":"active","version":"2.2.1","language":"javascript","source_language":"en","source_url":"git://github.com/cayasso/cacheman","tags":["javascript","cache","file","redis","memory","mongodb","caching","mongo","store"],"install":[{"cmd":"npm install cacheman","lang":"bash","label":"npm"},{"cmd":"yarn add cacheman","lang":"bash","label":"yarn"},{"cmd":"pnpm add cacheman","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM only since v2.0.0","wrong":"const Cacheman = require('cacheman')","symbol":"Cacheman","correct":"import Cacheman from 'cacheman'"},{"note":"Must use new keyword","wrong":"const cache = Cacheman();","symbol":"Cacheman constructor","correct":"const cache = new Cacheman();"},{"note":"When passing engine options as second arg, first arg must be the name","wrong":"const cache = new Cacheman({ engine: 'redis' });","symbol":"Cacheman with options","correct":"const cache = new Cacheman('myapp', { ttl: 300, engine: 'redis' });"}],"quickstart":{"code":"import Cacheman from 'cacheman';\nconst cache = new Cacheman('myapp', { ttl: 60 });\nawait cache.set('user', { name: 'Alice' });\nconst user = await cache.get('user');\nconsole.log(user); // { name: 'Alice' }\nawait cache.del('user');\nawait cache.clear();\nconsole.log('done');","lang":"javascript","description":"Creates a cache instance with a 60-second TTL, stores and retrieves a user object, then deletes and clears."},"warnings":[{"fix":"Use async/await or .then() instead of callbacks","message":"Callback API is deprecated in favor of Promises","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Install engine package (e.g., npm install cacheman-redis) and pass name as string","message":"Engine must be installed separately; no runtime dependency","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Import 'ms' or use numeric seconds directly","message":"TLL value accepts human-readable strings (e.g., '1m') but only if you install the 'ms' package","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.2.1':21 'allow':22 'api':37 'applic':60 'cach':6,52,71,76 'cacheman':1,53 'callback':44 'chang':59 'clear':41 'code':61 'configur':24 'custom':27 'del':40 'delimit':28 'develop':66 'effici':5 'engin':19,51,57 'environ':69 'file':15,72 'flexibl':23 'get':39 'ideal':64 'in-memori':12 'interfac':47 'javascript':70 'let':54 'make':62 'memori':14,74 'mongo':77 'mongodb':18,75 'node.js':9 'product':68 'promis':30,46 'provid':7,33 'redi':16,73 'set':38 'simpl':35 'singl':50 'single-engin':49 'small':3 'store':78 'support':11,31 'switch':56 'ttl':26 'unifi':36 'unlik':48 'version':20 'vs':67 'without':58","created_at":"2026-06-05T16:55:12.309280+00:00","updated_at":"2026-06-05T16:55:12.309280+00:00","problems":[{"fix":"Run: npm install cacheman-redis","cause":"Redis engine not installed","error":"Error: Cannot find module 'cacheman-redis'"},{"fix":"Use: const cache = new Cacheman();","cause":"Using import incorrectly or missing new keyword","error":"TypeError: Cacheman is not a constructor"},{"fix":"Ensure global Promise is available or use callbacks","cause":"Using Promises without Promise library or mixing callbacks into promise chain","error":"TypeError: cache.set(...).then 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/cayasso/cacheman#readme","github":"git://github.com/cayasso/cacheman","docs":null,"changelog":null,"pypi":null,"npm":"cacheman","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}