{"id":46094,"library":"redis-csc","title":"redis-csc","description":"Redis client-side caching wrapper for ioredis using Redis 6+ CLIENT TRACKING BCAST mode. Current stable version is 1.0.7 (last updated October 2023). It automatically invalidates local in-memory cache when subscribed key prefixes change in Redis, reducing latency and server load. Unlike generic caching libraries, this uses native Redis tracking for real-time invalidation without polling. Requires Redis >=6.0 and ioredis >=5.0 as a peer dependency. Ships TypeScript types and supports NOLOOP to avoid self-invalidation.","status":"active","version":"1.0.7","language":"javascript","source_language":"en","source_url":"https://github.com/GIVA-Jewellery/redis-csc","tags":["javascript","redis","ioredis","cache","client-side-caching","tracking","performance","typescript"],"install":[{"cmd":"npm install redis-csc","lang":"bash","label":"npm"},{"cmd":"yarn add redis-csc","lang":"bash","label":"yarn"},{"cmd":"pnpm add redis-csc","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency >=5.0.0; used as the Redis client","package":"ioredis","optional":false}],"imports":[{"note":"ESM default is named export; commonjs usage may need destructuring. The package ships TypeScript types.","wrong":"const RedisClientSideCache = require('redis-csc')","symbol":"RedisClientSideCache","correct":"import { RedisClientSideCache } from 'redis-csc'"},{"note":"The class constructor is private; you must use the static create() method which returns a promise.","wrong":"const cache = new RedisClientSideCache(redis, prefixes, ...)","symbol":"create (static method)","correct":"const cache = await RedisClientSideCache.create(redis, prefixes, defaultExpiry, callback, readyTimeoutMs, localCacheTTL)"},{"note":"Cache operations are methods on the instance returned by create(), not on the class itself. The library does not extend ioredis.","wrong":"await cache.get('key')","symbol":"getCached / setCached","correct":"await cache.getCached('key')\nawait cache.setCached('key', value, ttl?)"}],"quickstart":{"code":"import Redis from 'ioredis';\nimport { RedisClientSideCache } from 'redis-csc';\n\nconst redis = new Redis({ host: process.env.REDIS_HOST ?? 'localhost', port: Number(process.env.REDIS_PORT ?? 6379) });\nconst prefixes = ['user:', 'product:'];\nconst defaultExpiry = 3600;\nconst invalidationCallback = (keys) => console.log('Invalidated:', keys);\nconst readyTimeoutMs = 5000;\nconst localCacheTTL = 300;\n\nconst cache = await RedisClientSideCache.create(redis, prefixes, defaultExpiry, invalidationCallback, readyTimeoutMs, localCacheTTL);\n\nconst { data, cacheHits } = await cache.getCached('user:123');\nconsole.log('User:', data, 'Cache hits:', cacheHits);\n\nawait cache.setCached('user:123', JSON.stringify({ name: 'John' }), 3600);","lang":"typescript","description":"Shows instantiation via async create() method, then getCached and setCached operations."},"warnings":[{"fix":"Replace `new RedisClientSideCache(...)` with `await RedisClientSideCache.create(...)`.","message":"Constructor is private; must use static create() method.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use individual getCached/setCached in loops until methods are stable.","message":"The mGetCached and mSetCached methods are present but not documented; may be unstable.","severity":"deprecated","affected_versions":"1.0.7"},{"fix":"Ensure Redis 6+ is running. The lib will fail silently or throw an error if tracking is unsupported.","message":"Requires Redis server version >=6.0; CLIENT TRACKING command unavailable on older versions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set both defaultExpiry (Redis key TTL) and localCacheTTL independently to avoid stale data in local cache.","message":"Local cache TTL (localCacheTTL) applies only to the in-memory cache, not the Redis key TTL.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use prefix-based tracking; for per-key tracking consider alternatives like redis-lru-cache.","message":"Only BCAST mode with prefix tracking is supported; REDIRECT mode (per-key tracking) is not implemented.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.7':23 '2023':27 '5.0':69 '6':14 '6.0':66 'automat':29 'avoid':81 'bcast':17 'cach':8,35,50,88,92 'chang':40 'client':6,15,90 'client-sid':5 'client-side-cach':89 'csc':3 'current':19 'depend':73 'generic':49 'in-memori':32 'invalid':30,61,84 'ioredi':11,68,87 'javascript':85 'key':38 'last':24 'latenc':44 'librari':51 'load':47 'local':31 'memori':34 'mode':18 'nativ':54 'noloop':79 'octob':26 'peer':72 'perform':94 'poll':63 'prefix':39 'real':59 'real-tim':58 'redi':2,4,13,42,55,65,86 'redis-csc':1 'reduc':43 'requir':64 'self':83 'self-invalid':82 'server':46 'ship':74 'side':7,91 'stabl':20 'subscrib':37 'support':78 'time':60 'track':16,56,93 'type':76 'typescript':75,95 'unlik':48 'updat':25 'use':12,53 'version':21 'without':62 'wrapper':9","created_at":"2026-06-07T12:58:15.962998+00:00","updated_at":"2026-06-07T12:58:15.962998+00:00","problems":[{"fix":"Use `const { RedisClientSideCache } = require('redis-csc');` instead of `const RedisClientSideCache = require('redis-csc');`.","cause":"Using CommonJS require incorrectly without destructuring the named export.","error":"TypeError: RedisClientSideCache.create is not a function"},{"fix":"Upgrade Redis server to 6.0 or later.","cause":"The library uses NOLOOP but your Redis server version may not support it (requires Redis 6.0+).","error":"RedisError: ERR NOLOOP can't be used with BCAST"},{"fix":"Increase readyTimeoutMs or check Redis connection settings.","cause":"The readyTimeoutMs passed to create() was too short or Redis server is unreachable.","error":"Error: Connection timeout"}],"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/GIVA-Jewellery/redis-csc.git","github":"https://github.com/GIVA-Jewellery/redis-csc","docs":null,"changelog":null,"pypi":null,"npm":"redis-csc","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","storage"],"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}}