1.0.4 ⢠Published 4 months ago
@spurtcommerce/redis-cache v1.0.4
@spurtcommerce/redis-cache
š„ Effortless Redis-based API caching for Express.js
This package allows you to cache specific API responses in Redis with minimal configuration. Just plug it in, specify your routes and TTLs (in seconds), and you're good to go ā Boom! Cache is integrated.
⨠Features
- Super easy to integrate
- Route-specific TTL configuration
- Global middleware for clean architecture
- Powered by Redis
š¦ Installation
npm install @spurtcommerce/redis-cache
Sample Code
import { initRedis, cacheMiddleware } from '@spurtcommerce/redis-cache';
await initRedis(REDIS_URL);
app.use(
cacheMiddleware({ // Mention the Reqiured Api path to cache with duration in seconds
'/api/list/banner': 5,
'/api/list/language': 5,
'/api/pages': 5,
'/api/list/blog/blog-list': 5,
})
);