{"id":46067,"library":"recacheman-redis","title":"recacheman-redis","description":"Redis standalone caching library for Node.js and cache engine for cacheman. Version 4.2.0 uses redis library 5.x. Supports Redis connection via URI, options object, or client instance. TTL support. Callback-based API. Ships TypeScript definitions. A maintained fork of cacheman-redis.","status":"active","version":"4.2.0","language":"javascript","source_language":"en","source_url":"git://github.com/aalfiann/recacheman-redis","tags":["javascript","cache","redis","caching","store","ttl","cacheman","typescript"],"install":[{"cmd":"npm install recacheman-redis","lang":"bash","label":"npm"},{"cmd":"yarn add recacheman-redis","lang":"bash","label":"yarn"},{"cmd":"pnpm add recacheman-redis","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The underlying Redis driver; version 5.x for recacheman-redis 4.x.","package":"redis","optional":false}],"imports":[{"note":"Package uses CommonJS; no default ES module export. Use require().","wrong":"import CachemanRedis from 'recacheman-redis';","symbol":"CachemanRedis","correct":"var CachemanRedis = require('recacheman-redis');"},{"note":"TypeScript: use import = require() due to CJS nature. Destructuring import fails.","wrong":"import { CachemanRedis } from 'recacheman-redis';","symbol":"CachemanRedis","correct":"import CachemanRedis = require('recacheman-redis');"},{"note":"Constructor can take options object, string URL, or client instance. Instantiate first.","wrong":"new CachemanRedis().set(...)","symbol":"CachemanRedis","correct":"const cache = new CachemanRedis(options);"}],"quickstart":{"code":"var CachemanRedis = require('recacheman-redis');\nvar cache = new CachemanRedis({ host: process.env.REDIS_HOST ?? 'localhost', port: parseInt(process.env.REDIS_PORT ?? '6379') });\n\ncache.set('my key', { foo: 'bar' }, function (err) {\n  if (err) throw err;\n  cache.get('my key', function (err, value) {\n    if (err) throw err;\n    console.log(value); // -> { foo: 'bar' }\n    cache.del('my key', function (err) {\n      if (err) throw err;\n      console.log('value deleted');\n    });\n  });\n});","lang":"javascript","description":"Connects to Redis, sets a key, retrieves it, and deletes it using callbacks."},"warnings":[{"fix":"Use consistent pattern: new CachemanRedis(options) or new CachemanRedis('redis://...') or new CachemanRedis(client).","message":"Constructor expects different argument shapes; passing options as first arg works, but passing a single string as URL also works. Passing a Redis client object works if it has a 'client' property or directly as the first arg.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use util.promisify or wrap in Promises: const { promisify } = require('util'); const getAsync = promisify(cache.get).bind(cache);","message":"Callback-based API. No promise support built in; must promisify manually.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Prefer URL string or socket options (socket.host, socket.port) instead of host/port.","message":"If using redis 5.x, host and port are not standard options in the underlying redis client; this library maps them but be aware of potential issues with other options.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Upgrade Node.js to version 20 or higher.","message":"Version 4.x dropped Node 14 and 16; requires Node 20 or 22.","severity":"breaking","affected_versions":">=4.0.0"}],"env_vars":null,"search_vec":"'4.2.0':16 '5':20 'api':37 'base':36 'cach':6,11,49,51 'cacheman':14,46,54 'cacheman-redi':45 'callback':35 'callback-bas':34 'client':30 'connect':24 'definit':40 'engin':12 'fork':43 'instanc':31 'javascript':48 'librari':7,19 'maintain':42 'node.js':9 'object':28 'option':27 'recacheman':2 'recacheman-redi':1 'redi':3,4,18,23,47,50 'ship':38 'standalon':5 'store':52 'support':22,33 'ttl':32,53 'typescript':39,55 'uri':26 'use':17 'version':15 'via':25 'x':21","created_at":"2026-06-07T12:58:07.135354+00:00","updated_at":"2026-06-07T12:58:07.135354+00:00","problems":[{"fix":"Use require: var CachemanRedis = require('recacheman-redis');","cause":"Using ES module import syntax (import) with a CommonJS package.","error":"TypeError: CachemanRedis is not a constructor"},{"fix":"Ensure Redis is started. Pass correct host/port or URL.","cause":"Redis server not running or incorrect connection parameters.","error":"Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED"},{"fix":"Use correct signature: cache.set(key, value, [ttl], fn). Ensure last argument is function.","cause":"Passing TTL as separate argument but missing callback, or mixing order.","error":"ERR wrong number of arguments for 'set' command"},{"fix":"Use 'new CachemanRedis()' and assign to a variable.","cause":"Instantiating CachemanRedis incorrectly, e.g., without 'new' or misassigned variable.","error":"TypeError: cache.get 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/aalfiann/recacheman-redis#readme","github":"git://github.com/aalfiann/recacheman-redis","docs":null,"changelog":null,"pypi":null,"npm":"recacheman-redis","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}}