A TypeScript-first library for tracking RPC call counts and other action metrics using Redis time-bucketed counters. Version 1.1.9 is the current stable release with no breaking changes reported. It provides four main exports: `statis` for connection setup (standalone, cluster, or passing an existing ioredis instance), `trackAction` for incrementing counters, `searchKeys` for scanning Redis keys by pattern, and `statRedis` for reading counter values. Key differentiators include automatic time-bucket expiry (seconds to years), support for both module-specific and global counter namespaces, and native TypeScript definitions.
npm install redis-trackerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows connection setup with standalone Redis, tracking an action, and retrieving counts using searchKeys and statRedis.
Upgrade to latest version: npm install redis-tracker@latest
Call trackAction without await; use a separate mechanism for error handling if needed.
Implement retry logic, or use a dedicated aggregation store if exact counts are required.
Wrap with Number() and handle null: Number((await statRedis.get(key)) || 0)
Ensure you called statis.redis.standalone() or .cluster() before using statRedis.
Use ESM import: import { statis } from 'redis-tracker'; and upgrade to latest version.Install: npm install redis-tracker. Ensure your project supports ESM (e.g., "type": "module" in package.json).
Start Redis server or check REDIS_HOST/REDIS_PORT environment variables.