{"id":46341,"library":"sequelize-transparent-cache-ioredis","title":"Sequelize Transparent Cache ioredis Adapter","description":"This package is an adapter for sequelize-transparent-cache that uses ioredis as the caching backend. Version 2.3.0 is stable and compatible with sequelize-transparent-cache v2+. It stores Sequelize model instances as JSON strings in Redis, with optional namespace prefix and TTL. Unlike other adapters, it directly integrates with ioredis, providing robust Redis features like clustering and Sentinel. Release cadence is low; updates follow ioredis major versions.","status":"active","version":"2.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/DanielHreben/sequelize-transparent-cache","tags":["javascript","sequelize","cache","redis","ioredis","plugin","adaptor","adapter"],"install":[{"cmd":"npm install sequelize-transparent-cache-ioredis","lang":"bash","label":"npm"},{"cmd":"yarn add sequelize-transparent-cache-ioredis","lang":"bash","label":"yarn"},{"cmd":"pnpm add sequelize-transparent-cache-ioredis","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; this adapter requires the core caching library.","package":"sequelize-transparent-cache","optional":false},{"reason":"Peer dependency; the Redis client instance must be provided.","package":"ioredis","optional":false}],"imports":[{"note":"The package exports a single default class. Named import will fail. CommonJS require gets the default, but destructuring does not work.","wrong":"const { RedisAdaptor } = require('sequelize-transparent-cache-ioredis')","symbol":"default","correct":"import RedisAdaptor from 'sequelize-transparent-cache-ioredis'"},{"note":"CJS require returns the constructor directly; no .default needed.","wrong":"const RedisAdaptor = require('sequelize-transparent-cache-ioredis').default","symbol":"RedisAdaptor","correct":"const RedisAdaptor = require('sequelize-transparent-cache-ioredis')"},{"note":"No named export exists; must use namespace import and access .default.","wrong":"import { RedisAdaptor } from 'sequelize-transparent-cache-ioredis'","symbol":"RedisAdaptor (ESM with namespace)","correct":"import * as pkg from 'sequelize-transparent-cache-ioredis'; const RedisAdaptor = pkg.default"}],"quickstart":{"code":"const Redis = require('ioredis');\nconst redis = new Redis({ host: 'localhost', port: 6379 });\nconst Sequelize = require('sequelize');\nconst sequelize = new Sequelize('sqlite::memory:');\nconst RedisAdaptor = require('sequelize-transparent-cache-ioredis');\nconst cacheAdaptor = new RedisAdaptor({ client: redis, namespace: 'myapp', lifetime: 3600 });\nconst { init } = require('sequelize-transparent-cache');\nconst { withCache } = init(cacheAdaptor);\nconst User = sequelize.define('User', { name: Sequelize.STRING });\nconst CachedUser = withCache(User);\n(async () => {\n  await sequelize.sync();\n  const user = await CachedUser.create({ name: 'Alice' });\n  console.log('User cached in Redis');\n})();","lang":"javascript","description":"Shows how to set up the ioredis adapter with sequelize-transparent-cache and cache a Sequelize model."},"warnings":[{"fix":"Use `new Redis()` from the `ioredis` package, not `redis` or `node-redis`.","message":"The adapter expects an ioredis instance; providing a Redis client from another library will fail at runtime.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pin to exact version or test upgrades carefully.","message":"The package does not follow semantic versioning strictly; minor versions may introduce breaking changes if peer dependencies change.","severity":"deperecated","affected_versions":">=2.0.0"},{"fix":"Avoid colons in namespace string.","message":"Namespace must not contain colon ':' as it is used as delimiter; otherwise keys may collide or be ambiguous.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If per-model TTL needed, consider multiple adapters or custom logic.","message":"lifetime is set per adapter instance, not per model; all cached objects share the same TTL unless overridden at query level.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2.3.0':24 'adapt':5,10,53,83 'adaptor':82 'backend':22 'cach':3,15,21,33,78 'cadenc':68 'cluster':64 'compat':28 'direct':55 'featur':62 'follow':72 'instanc':39 'integr':56 'ioredi':4,18,58,73,80 'javascript':76 'json':41 'like':63 'low':70 'major':74 'model':38 'namespac':47 'option':46 'packag':7 'plugin':81 'prefix':48 'provid':59 'redi':44,61,79 'releas':67 'robust':60 'sentinel':66 'sequel':1,13,31,37,77 'sequelize-transparent-cach':12,30 'stabl':26 'store':36 'string':42 'transpar':2,14,32 'ttl':50 'unlik':51 'updat':71 'use':17 'v2':34 'version':23,75","created_at":"2026-06-07T12:59:27.636854+00:00","updated_at":"2026-06-07T12:59:27.636854+00:00","problems":[{"fix":"Use `const RedisAdaptor = require('sequelize-transparent-cache-ioredis')` or `import RedisAdaptor from ...`.","cause":"Importing the module incorrectly, e.g., using named import when it's a default export.","error":"TypeError: RedisAdaptor is not a constructor"},{"fix":"Ensure the client is created via `new Redis()` from the `ioredis` package.","cause":"Passing a Redis client from a different library (e.g., `redis` package) or not passing a client at all.","error":"Error: Invalid client provided. Expected ioredis instance."},{"fix":"Start a Redis server or configure ioredis with correct connection options.","cause":"No Redis server running or wrong host/port.","error":"Error: connect ECONNREFUSED 127.0.0.1:6379"}],"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/DanielHreben/sequelize-transparent-cache#readme","github":"https://github.com/DanielHreben/sequelize-transparent-cache","docs":null,"changelog":null,"pypi":null,"npm":"sequelize-transparent-cache-ioredis","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}}