Unified cache plugin for the Najm framework (v1.2.9) with in-memory and Redis drivers. Provides automatic fallback to memory when Redis is unavailable. Supports common caching patterns (get/set, JSON, cache-aside, atomic increment). Uses reflect-metadata optionally for dependency injection. Ideal for single-instance (memory) or multi-instance (Redis) deployment. Ships TypeScript types.
npm install najm-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up a Najm server with in-memory caching. No Redis setup needed.
Configure Redis driver with .use(cache({ redis: { url: process.env.REDIS_URL! } }))Install reflect-metadata: bun add reflect-metadata
Install ioredis: bun add ioredis
Install ioredis: bun add ioredis
Install reflect-metadata: bun add reflect-metadata
Use import { cache } from 'najm-cache'