Simple and powerful caching for Node.js - Local memory and Redis made easy
npm install @cr7bit/cacheflowbash
npm install @cr7bit/cacheflow
`
`javascript
import { createCache } from '@cr7bit/cacheflow';
// Create cache
const cache = await createCache();
// Cache your data - it's that simple!
const user = await cache.getOrFetch('user:123', async () => {
return await database.getUser(123);
});
`
Features
- ๐ Simple - 3 lines to get started
- โก Fast - In-memory Map-based caching
- ๐ Scalable - Add Redis when you need it
- ๐ก๏ธ Production Ready - Auto-reconnect, health checks, graceful shutdown
- ๐ Smart Failover - Automatic Redis โ Local fallback
- ๐งน Auto Cleanup - Scheduled expiration management
Documentation
๐ Full Documentation - Visit our documentation website for:
- Getting Started Guide
- Complete API Reference
- Real-world Examples
- Docker Setup Guide
- Why CacheFlow?
Quick Links
- GitHub Repository
- NPM Package
- Documentation
- Issues
Configuration
Create a .env file:
`bash
Optional - defaults to local cache
REDIS_ENABLED=true
REDIS_URL=redis://localhost:6379
DEFAULT_TTL=3600
`
Docker
`bash
docker-compose up -d
``