{"id":44873,"library":"exp-rediscache","title":"exp-rediscache","description":"A Redis caching library (v5.1.0) designed to integrate with exp-asynccache. It provides a simple interface for caching values in Redis with optional TTL via SETEX, supports key namespacing, and configures the underlying Redis client's offline queue behavior. Stable release, actively maintained, no major updates in recent months. Differentiator: lightweight, relies on exp-asynccache for async caching patterns, minimal setup.","status":"active","version":"5.1.0","language":"javascript","source_language":"en","source_url":"git://github.com/ExpressenAB/exp-rediscache","tags":["javascript","cache","redis"],"install":[{"cmd":"npm install exp-rediscache","lang":"bash","label":"npm"},{"cmd":"yarn add exp-rediscache","lang":"bash","label":"yarn"},{"cmd":"pnpm add exp-rediscache","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The underlying Redis client used for all cache operations. Version 2.x of redis is expected.","package":"redis","optional":false}],"imports":[{"note":"ESM only. Default export is not available.","wrong":"const RedisCache = require('exp-rediscache').RedisCache","symbol":"RedisCache","correct":"import { RedisCache } from 'exp-rediscache'"},{"note":"There is no default export. Must use named import.","wrong":"const RedisCache = require('exp-rediscache')","symbol":"RedisCache (default import)","correct":"import RedisCache from 'exp-rediscache'"},{"note":"Options are typed inline; no separate export of options interface.","wrong":null,"symbol":"RedisCacheOptions","correct":"import { RedisCache } from 'exp-rediscache';\n// options are passed as constructor argument (no separate type export)"}],"quickstart":{"code":"import { RedisCache } from 'exp-rediscache';\nimport { AsyncCache } from 'exp-asynccache';\n\nconst cache = new AsyncCache(new RedisCache({\n  host: process.env.REDIS_HOST ?? 'localhost',\n  port: parseInt(process.env.REDIS_PORT ?? '6379', 10),\n  enableOfflineQueue: false,\n  keyPrefix: 'myapp'\n}));\n\ncache.lookup('key', (resolve) => {\n  resolve(null, 'value', 60); // cache for 60 seconds\n}).then(value => {\n  console.log(value);\n}).catch(err => {\n  console.error(err);\n});","lang":"typescript","description":"Initializes a RedisCache with custom host, port, offline queue disabled, and key prefix; shows lookup with TTL."},"warnings":[{"fix":"Set `enableOfflineQueue: false` in RedisCache options to fail fast.","message":"The underlying redis client (v2.x) queues commands when offline by default. This can cause unexpected delays and memory buildup if Redis is down.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider migrating to a package that uses `ioredis` or newer `redis` v4 for future-proofing.","message":"The package depends on the deprecated `redis` v2.x package, which is no longer actively maintained and lacks support for modern Redis features.","severity":"deprecated","affected_versions":"<=5.1.0"},{"fix":"Include a separator in the prefix value, e.g., `keyPrefix: 'myapp:'`.","message":"The `keyPrefix` option does not automatically include a separator (e.g., colon). Keys are stored exactly as `<prefix><key>` without any delimiter.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'activ':46 'async':62 'asynccach':15,60 'behavior':43 'cach':6,22,63,68 'client':39 'configur':35 'design':9 'differenti':54 'exp':2,14,59 'exp-asynccach':13,58 'exp-rediscach':1 'integr':11 'interfac':20 'javascript':67 'key':32 'librari':7 'lightweight':55 'maintain':47 'major':49 'minim':65 'month':53 'namespac':33 'offlin':41 'option':27 'pattern':64 'provid':17 'queue':42 'recent':52 'redi':5,25,38,69 'rediscach':3 'releas':45 'reli':56 'setex':30 'setup':66 'simpl':19 'stabl':44 'support':31 'ttl':28 'under':37 'updat':50 'v5.1.0':8 'valu':23 'via':29","created_at":"2026-06-07T12:52:15.874197+00:00","updated_at":"2026-06-07T12:52:15.874197+00:00","problems":[{"fix":"Ensure you import the named export: `import { RedisCache } from 'exp-rediscache'`.","cause":"Using incorrect import or require without proper instantiation.","error":"TypeError: RedisCache is not a constructor"},{"fix":"Add `password` option to RedisCache constructor: `new RedisCache({ password: 'yourpassword' })`.","cause":"Redis server requires password but none provided.","error":"Error: NOAUTH Authentication required."},{"fix":"Start Redis: `redis-server` or adjust host/port options.","cause":"Redis server not running or unreachable.","error":"Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED"}],"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/ExpressenAB/exp-rediscache#readme","github":"git://github.com/ExpressenAB/exp-rediscache","docs":null,"changelog":null,"pypi":null,"npm":"exp-rediscache","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}}