An implementation of the Generic Cell Rate Algorithm (GCRA) for rate limiting using Redis. Version 0.7.0 is the latest stable release, updated as of early 2025. It supports both ioredis and node-redis clients, with TypeScript type definitions included. Key differentiators are its reliance on the efficient GCRA algorithm (no token bucket overhead) and minimal dependencies. The package provides three core methods: limit (attempt to consume tokens), peek (check availability without consumption), and reset (clear state for a key). It is actively maintained by Losant with a focus on correctness and performance.
npm install redis-gcraNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes a GCRA limiter with an ioredis client and performs a rate limit check using the limit method.
Use import rather than require, or stick with v0.6.x if CJS required.
Upgrade Node.js to v20 or later.
Use ioredis instead of node-redis for compatibility, or manually adapt node-redis client.
None yet; follow releases for future changes.
Guard against null: const result = await limiter.limit(...); if (result) { ... }Upgrade to Node.js v20 or above.
Change to import RedisGCRA from 'redis-gcra'.
Use import or downgrade to v0.6.x.
Switch to ioredis or wrap node-redis with a defineCommand shim.
No dependency data recorded yet.