{"id":46380,"library":"simple-redis-cache","title":"simple-redis-cache","description":"Simple Redis caching library for Node.js with connection pooling via generic-pool. Version 1.6.1 is the latest stable release as of 2025. It provides a straightforward key-value cache backed by Redis with configurable options for Redis connection, pool settings, serialization, logging, and expiration. Features both sync and async APIs, semaphore-based locking for distributed concurrency, and built-in statistics. It supports Node >=4 and uses ES6 features. Release cadence is low; the package appears to be in maintenance mode with infrequent updates.","status":"maintenance","version":"1.6.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/pasupulaphani/simple-redis-cache","tags":["javascript","redis","cache","store","connection","pool","node-pool","generic-pool","connection pooling"],"install":[{"cmd":"npm install simple-redis-cache","lang":"bash","label":"npm"},{"cmd":"yarn add simple-redis-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add simple-redis-cache","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to connect to Redis server; the package wraps node_redis.","package":"redis","optional":false},{"reason":"Used for connection pooling to manage Redis connections efficiently.","package":"generic-pool","optional":false}],"imports":[{"note":"This package does not ship TypeScript types and does not support ESM imports. Use CommonJS require.","wrong":"import RedisCache from 'simple-redis-cache'","symbol":"RedisCache","correct":"const RedisCache = require('simple-redis-cache')"},{"note":"Redis connection options must be nested under 'redisOptions' property, not flat on the options object.","wrong":"const cache = new RedisCache({ host: 'localhost' })","symbol":"RedisCache (new instance)","correct":"const cache = new RedisCache({ redisOptions: { host: 'localhost', port: 6379 } })"},{"note":"Expiration is configured globally via options, not per-call. The set/get APIs are simple; no TTL argument.","wrong":"cache.set('key', 'value', 'EX', 60)","symbol":"set/get methods","correct":"cache.set('key', 'value'); cache.get('key').then(val => console.log(val))"}],"quickstart":{"code":"const RedisCache = require('simple-redis-cache');\nconst cache = new RedisCache({\n  redisOptions: {\n    host: process.env.REDIS_HOST || 'localhost',\n    port: parseInt(process.env.REDIS_PORT || '6379'),\n    password: process.env.REDIS_PASSWORD || ''\n  },\n  poolOptions: {\n    max: 10,\n    min: 2\n  },\n  logger: console\n});\n\n// Set and get values\ncache.set('greeting', 'Hello, world!');\ncache.get('greeting').then(value => {\n  console.log('Cached value:', value);\n});\n\n// Clean up\ncache.end();","lang":"javascript","description":"Initializes a Redis cache with connection pooling, sets a value, retrieves it, and closes the connection."},"warnings":[{"fix":"Set defaultExpiration and defaultExpirationMode in options (not documented but present in source). Review source or use an alternative library if per-key TTL is required.","message":"Expiration must be configured globally; per-call TTL is NOT supported.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure you are using the documented async methods (get, set return promises). For sync methods, handle callbacks. Check source if unsure.","message":"The package does not use a Promise-based API internally for all methods; some are callback-based or sync.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider migrating to a modern caching library like ioredis or redis v4 directly.","message":"The package depends on node_redis (v2.x) which is deprecated in favor of redis v4.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Pin your generic-pool version to match the one used by simple-redis-cache, or test thoroughly after updates.","message":"When using poolOptions, the underlying generic-pool may have breaking changes between versions.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.6.1':19 '2025':27 '4':72 'api':56 'appear':83 'async':55 'back':36 'base':59 'built':66 'built-in':65 'cach':4,7,35,94 'cadenc':78 'concurr':63 'configur':40 'connect':12,44,96,104 'distribut':62 'es6':75 'expir':50 'featur':51,76 'generic':16,102 'generic-pool':15,101 'infrequ':90 'javascript':92 'key':33 'key-valu':32 'latest':22 'librari':8 'lock':60 'log':48 'low':80 'mainten':87 'mode':88 'node':71,99 'node-pool':98 'node.js':10 'option':41 'packag':82 'pool':13,17,45,97,100,103,105 'provid':29 'redi':3,6,38,43,93 'releas':24,77 'semaphor':58 'semaphore-bas':57 'serial':47 'set':46 'simpl':2,5 'simple-redis-cach':1 'stabl':23 'statist':68 'store':95 'straightforward':31 'support':70 'sync':53 'updat':91 'use':74 'valu':34 'version':18 'via':14","created_at":"2026-06-07T12:59:38.116660+00:00","updated_at":"2026-06-07T12:59:38.116660+00:00","problems":[{"fix":"Use const RedisCache = require('simple-redis-cache') instead of import.","cause":"Importing the package as default ES module instead of CommonJS.","error":"TypeError: cache.set is not a function"},{"fix":"Ensure Redis is running and options.redisOptions.host/port are correct.","cause":"Redis server not running or wrong host/port.","error":"Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED"},{"fix":"Create an instance: const cache = new RedisCache(); then call cache.set()","cause":"Forgetting to instantiate RedisCache (using RedisCache.set directly instead of new RedisCache().set).","error":"TypeError: Cannot read property 'get' of undefined"}],"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/pasupulaphani/simple-redis-cache#readme","github":"ssh://git@github.com/pasupulaphani/simple-redis-cache","docs":null,"changelog":null,"pypi":null,"npm":"simple-redis-cache","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}}