{"_id":"@djs-commands/adapter-redis","_rev":"4-c147d5ac0cd75b4986d69486df7e50d2","name":"@djs-commands/adapter-redis","dist-tags":{"latest":"3.1.0"},"versions":{"2.0.0":{"name":"@djs-commands/adapter-redis","version":"2.0.0","keywords":["discord.js","discord","redis","ioredis","cache-adapter","cooldown"],"author":{"name":"D3OXY","email":"hello@deoxy.dev"},"license":"MIT","_id":"@djs-commands/adapter-redis@2.0.0","maintainers":[{"name":"d3oxy","email":"ishansachu1@gmail.com"}],"homepage":"https://github.com/D3OXY/djs-commands#readme","bugs":{"url":"https://github.com/D3OXY/djs-commands/issues"},"dist":{"shasum":"339cecba2232ac3b856b3641f193cf264cab145f","tarball":"https://registry.npmjs.org/@djs-commands/adapter-redis/-/adapter-redis-2.0.0.tgz","fileCount":8,"integrity":"sha512-QF3ss0RLN2CTj0pVTbkRjdQcegvBOe2H02L+MzH+cW4M9sBzlPDQTPnr+GS3eSFnOkr77qQh54JXmMVBsplWPg==","signatures":[{"sig":"MEYCIQCQT/O8HBFCXDz/bJx63b9JI6r018b01KRjOLyCOvbvbAIhAJ6f1pgEcLqA9t1XsYQnwdvLDE0n9oOZxWZrWj4vP99g","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7425},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"e4414d61c537df09b91e66677d3919b4258f65a5","scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"d3oxy","email":"ishansachu1@gmail.com"},"repository":{"url":"git+https://github.com/D3OXY/djs-commands.git","type":"git","directory":"packages/adapter-redis"},"_npmVersion":"11.8.0","description":"Redis CacheAdapter for djs-commands cooldowns — distributed, TTL-native cooldown storage","directories":{},"_nodeVersion":"24.13.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ioredis":"^5.4.1","@types/bun":"catalog:","typescript":"catalog:","@types/node":"catalog:","expect-type":"^1.2.0","@djs-commands/core":"workspace:*","@djs-commands/tsconfig":"workspace:*"},"peerDependencies":{"ioredis":"^5.0.0","@djs-commands/core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/adapter-redis_2.0.0_1777967332382_0.8582933153529404","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@djs-commands/adapter-redis","version":"2.0.1","keywords":["discord.js","discord","redis","ioredis","cache-adapter","cooldown"],"author":{"name":"D3OXY","email":"hello@deoxy.dev"},"license":"MIT","_id":"@djs-commands/adapter-redis@2.0.1","maintainers":[{"name":"d3oxy","email":"ishansachu1@gmail.com"}],"homepage":"https://github.com/D3OXY/djs-commands#readme","bugs":{"url":"https://github.com/D3OXY/djs-commands/issues"},"dist":{"shasum":"a657b7046f06af34b5173e340a9218c6a514415e","tarball":"https://registry.npmjs.org/@djs-commands/adapter-redis/-/adapter-redis-2.0.1.tgz","fileCount":8,"integrity":"sha512-xdKHfi5immzM/mlDakFzBaC3x7gmb2h56U0KbzvM+NtlOFh3W9O4YkPy6s5kQreq2Ub6VMXq1kz86V3nRCIcLA==","signatures":[{"sig":"MEYCIQCATCIRCGxakvaqOxFIzdtERVrRkUdQscR6kklqSKIVFAIhAMFJi/QYM/9mE8M5DIs2iH2SC0r3+4LIJ+Jme7r/ftux","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@djs-commands%2fadapter-redis@2.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8062},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"385b2b519e75a8352e65297aa53c0cf51105ac99","scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:f3e33cdc-c4e4-41b3-9958-57062634030a"}},"repository":{"url":"git+https://github.com/D3OXY/djs-commands.git","type":"git","directory":"packages/adapter-redis"},"_npmVersion":"11.11.0","description":"Redis CacheAdapter for djs-commands cooldowns — distributed, TTL-native cooldown storage","directories":{},"_nodeVersion":"24.14.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ioredis":"^5.4.1","@types/bun":"catalog:","typescript":"catalog:","@types/node":"catalog:","expect-type":"^1.2.0","@djs-commands/core":"workspace:*","@djs-commands/tsconfig":"workspace:*"},"peerDependencies":{"ioredis":"^5.0.0","@djs-commands/core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/adapter-redis_2.0.1_1777994348477_0.8627330048613038","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@djs-commands/adapter-redis","version":"3.0.0","keywords":["discord.js","discord","redis","ioredis","cache-adapter","cooldown"],"author":{"name":"D3OXY","email":"hello@deoxy.dev"},"license":"MIT","_id":"@djs-commands/adapter-redis@3.0.0","maintainers":[{"name":"d3oxy","email":"ishansachu1@gmail.com"}],"homepage":"https://github.com/D3OXY/djs-commands#readme","bugs":{"url":"https://github.com/D3OXY/djs-commands/issues"},"dist":{"shasum":"0f26e37e2bd867a3009e7521e004a54b680ab940","tarball":"https://registry.npmjs.org/@djs-commands/adapter-redis/-/adapter-redis-3.0.0.tgz","fileCount":8,"integrity":"sha512-IvtiKmchqppVYrKScIAjugeTP6T19QtKir3wXbYVFerWpXlJbhB2/CLLR4IBXB+pUglRNAj30tKlroG9UcodDw==","signatures":[{"sig":"MEQCIFTAm81hkEd0o3ly5hC60hyk7g0mCx6bCz+mv++cWNcyAiAj1E3QSV9yu0kbDGFL5pBPoNhni4yn0hLePmfeTz0mVg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@djs-commands%2fadapter-redis@3.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8062},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"30a619d93df51f37dbc6cca964988ff84daf99c1","scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:f3e33cdc-c4e4-41b3-9958-57062634030a"}},"repository":{"url":"git+https://github.com/D3OXY/djs-commands.git","type":"git","directory":"packages/adapter-redis"},"_npmVersion":"11.13.0","description":"Redis CacheAdapter for djs-commands cooldowns — distributed, TTL-native cooldown storage","directories":{},"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ioredis":"^5.4.1","@types/bun":"catalog:","typescript":"catalog:","@types/node":"catalog:","expect-type":"^1.2.0","@djs-commands/core":"workspace:*","@djs-commands/tsconfig":"workspace:*"},"peerDependencies":{"ioredis":"^5.0.0","@djs-commands/core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/adapter-redis_3.0.0_1781470224294_0.6847381129496213","host":"s3://npm-registry-packages-npm-production"}},"3.1.0":{"name":"@djs-commands/adapter-redis","version":"3.1.0","description":"Redis CacheAdapter for djs-commands cooldowns — distributed, TTL-native cooldown storage","author":{"name":"D3OXY","email":"hello@deoxy.dev"},"license":"MIT","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.build.json","dev":"tsc -p tsconfig.build.json --watch","typecheck":"tsc --noEmit","test":"bun test"},"peerDependencies":{"@djs-commands/core":"workspace:^","ioredis":"^5.0.0"},"devDependencies":{"@djs-commands/core":"workspace:*","@djs-commands/tsconfig":"workspace:*","@types/bun":"catalog:","@types/node":"catalog:","expect-type":"^1.2.0","ioredis":"^5.4.1","typescript":"catalog:"},"publishConfig":{"access":"public"},"engines":{"node":">=22.0.0"},"repository":{"type":"git","url":"git+https://github.com/D3OXY/djs-commands.git","directory":"packages/adapter-redis"},"keywords":["discord.js","discord","redis","ioredis","cache-adapter","cooldown"],"gitHead":"e400478f3eabfa3ef69165430168067eaba7c948","_id":"@djs-commands/adapter-redis@3.1.0","bugs":{"url":"https://github.com/D3OXY/djs-commands/issues"},"homepage":"https://github.com/D3OXY/djs-commands#readme","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-bYLI0TNjHYuL2iZV9ax6+dUEMuqeCP3xHe0vNOyrqaweV1lL3oL7QcZnSwab/g2xvcEG5XU/9sjJu6LSx3F9mw==","shasum":"6bbac477a2ff306b711cef572f20cf07b33cc0d6","tarball":"https://registry.npmjs.org/@djs-commands/adapter-redis/-/adapter-redis-3.1.0.tgz","fileCount":8,"unpackedSize":8207,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@djs-commands%2fadapter-redis@3.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDYeHxwM1HH2VyPfvxa3jOEyUO8TH0eMkai09FiE5U/MAiEArgUeQBkfhhsxyWqmjxIPE2V/14qZklx43Ub6QkhVPmM="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:f3e33cdc-c4e4-41b3-9958-57062634030a"}},"directories":{},"maintainers":[{"name":"d3oxy","email":"ishansachu1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adapter-redis_3.1.0_1781515404823_0.07292329862493108"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-05T07:48:52.271Z","modified":"2026-06-15T09:23:25.255Z","2.0.0":"2026-05-05T07:48:52.551Z","2.0.1":"2026-05-05T15:19:08.621Z","3.0.0":"2026-06-14T20:50:24.459Z","3.1.0":"2026-06-15T09:23:24.967Z"},"bugs":{"url":"https://github.com/D3OXY/djs-commands/issues"},"author":{"name":"D3OXY","email":"hello@deoxy.dev"},"license":"MIT","homepage":"https://github.com/D3OXY/djs-commands#readme","keywords":["discord.js","discord","redis","ioredis","cache-adapter","cooldown"],"repository":{"type":"git","url":"git+https://github.com/D3OXY/djs-commands.git","directory":"packages/adapter-redis"},"description":"Redis CacheAdapter for djs-commands cooldowns — distributed, TTL-native cooldown storage","maintainers":[{"name":"d3oxy","email":"ishansachu1@gmail.com"}],"readme":"# @djs-commands/adapter-redis\n\nRedis-backed `CacheAdapter` for [`@djs-commands/core`](https://www.npmjs.com/package/@djs-commands/core) cooldowns.\n\nDistributed, TTL-native cooldown storage so sharded bots have consistent cooldowns across processes. Uses `SET key value PX <ms>` for atomic set-with-TTL — Redis stores the absolute expiry timestamp as the value AND auto-evicts the key when the TTL elapses, so you never accumulate dead entries.\n\n📘 **Full walk-through: https://djscommands.deoxy.dev/adapter-cookbook#redis-cache-adapter-not-storage**\n\n## Install\n\n```bash\nbun add @djs-commands/core @djs-commands/adapter-redis ioredis\n```\n\n`ioredis` and `@djs-commands/core` are peer dependencies — install them in your app.\n\n## Usage\n\nPass an `ioredis` instance (URL, config, sentinel, cluster — whatever you like) into `redisCacheAdapter`, then hand the returned adapter to your command handler via the `cacheAdapter` option.\n\n```ts\nimport { Client, GatewayIntentBits } from \"discord.js\";\nimport { createCommandHandler } from \"@djs-commands/core\";\nimport { redisCacheAdapter } from \"@djs-commands/adapter-redis\";\nimport Redis from \"ioredis\";\n\nconst redis = new Redis(process.env.REDIS_URL!);\n\nconst client = new Client({ intents: [GatewayIntentBits.Guilds] });\n\ncreateCommandHandler({\n  client,\n  commands: [/* ... */],\n  cacheAdapter: redisCacheAdapter(redis),\n});\n\nawait client.login(process.env.DISCORD_TOKEN);\n```\n\nPair this with one of the storage adapters ([drizzle](https://www.npmjs.com/package/@djs-commands/adapter-drizzle) / [prisma](https://www.npmjs.com/package/@djs-commands/adapter-prisma) / [mongoose](https://www.npmjs.com/package/@djs-commands/adapter-mongoose)) for full persistence — `Storage` covers prefixes/locks (durable, low-traffic), `CacheAdapter` covers cooldowns (hot path, ephemeral).\n\n## Multi-bot deployments: `keyPrefix`\n\nWhen several bots share a single Redis instance, give each one a distinct prefix to avoid collisions:\n\n```ts\nconst cacheAdapter = redisCacheAdapter(redis, { keyPrefix: \"moderation-bot:\" });\n```\n\nEvery key the adapter reads or writes is prepended with this prefix. The default is `\"djs-commands:\"`.\n\n## How it works\n\nThe adapter implements three methods from the `CacheAdapter` interface:\n\n| Method   | Redis command                              |\n| -------- | ------------------------------------------ |\n| `set`    | `SET <prefix><key> <expiresAt> PX <ttlMs>` |\n| `get`    | `GET <prefix><key>` then parse to number   |\n| `delete` | `DEL <prefix><key>`                        |\n\n`get` returns `null` for missing keys, non-numeric values, or timestamps in the past — defensive against clock skew.\n\n## Testing\n\nUnit tests run with a mocked `ioredis` and don't require a Redis instance.\n\nIntegration tests run against a real Redis when `REDIS_URL` is set:\n\n```bash\nREDIS_URL=redis://localhost:6379 bun test\n```\n\nIf `REDIS_URL` isn't set, the integration suite skips cleanly. Spin one up locally with:\n\n```bash\ndocker run --rm -p 6379:6379 redis:7-alpine\n```\n\n## License\n\n[MIT](https://github.com/D3OXY/djs-commands/blob/main/LICENSE) · Issues + discussions on [GitHub](https://github.com/D3OXY/djs-commands).\n","readmeFilename":"README.md"}