Repository navigation
rate-limit-redis: v6.1.0
@routup/rate-limit-redis6.1.0 adds read-only counter access for count-after-response limiting and handles counters that expire during a read. These notes cover 6.0.0 → 6.1.0.
👀 Highlights
🔎 Count responses without reserving slots in Redis
RedisStore.get(key) reads the current hit count and reset time without incrementing the counter or refreshing its TTL. This enables @routup/rate-limit's countAfterResponse mode with Redis: pending requests no longer occupy slots that would later be refunded, useful when you count only failed authentication attempts.
import { App } from 'routup';
import { rateLimit } from '@routup/rate-limit';
import { RedisStore } from '@routup/rate-limit-redis';
const app = new App();
app.use(rateLimit({
max: 1,
skipSuccessfulRequest: true,
countAfterResponse: true,
store: new RedisStore(),
}));Note
Count-after-response is opt-in and does not reserve capacity: concurrent requests can pass before their responses are counted, so a burst can exceed max. Redis increments remain non-atomic; this release does not change that limitation.
📖 Redis store · Count-after-response configuration
⏱️ Expired counters read as missing
If a key expires between GET and PTTL, get() returns undefined rather than reporting a stale hit count for a window that has ended. Existing keys without an expiry still return their count, with no reset time.
⚠️ Heads-Up Before Upgrading
| Change | What to do |
|---|---|
The @routup/rate-limit peer range moves from ^4.0.3 to ^4.1.0 |
Upgrade the limiter alongside the Redis store. The routup peer range remains ^6.3.0; adoption of 6.5.0 here updates the development dependency. |
⬆️ Upgrading
npm install @routup/rate-limit-redis@^6.1.0 @routup/rate-limit@^4.1.0Keep your existing redis-extension and ioredis dependencies installed. Installation and requirements describe the Redis setup.
👉 Changelog
6.1.0 (2026-11-22)
Features
- adopt routup 6.5.0 (#884) (1553a5e)
- rate-limit-redis: read a counter without incrementing it (84997ed), closes #880
Bug Fixes
- rate-limit-redis: treat a key that expires between GET and PTTL as missing (252f269)
Dependencies
- The following workspace dependencies were updated
- devDependencies
- @routup/rate-limit bumped from ^4.0.3 to ^4.1.0
- peerDependencies
- @routup/rate-limit bumped from ^4.0.3 to ^4.1.0
- devDependencies