cache-vision
v0.0.4
Published
npm package with cache strategies that you can visualize
Readme
🚀 CacheVision – High-Performance Cache Manager with Redis
🔥 Overview
CacheVision is a lightweight, pluggable cache manager for Node.js that supports Redis as a caching backend. Built for high-performance applications, it enables seamless caching strategies with an easy-to-use API.
✨ Features
✅ Pluggable Cache Strategy – Supports Redis, easily extendable for others
✅ High Performance – Optimized for speed and efficiency
✅ TTL Support – Set expiration times for cache entries
✅ Simple API – Minimal configuration, ready to use
📦 Installation
npm install cachevision redis🚀 Usage
Basic Setup
import { CacheManager, RedisCacheStrategy } from 'cachevision';
const cache = new CacheManager(new RedisCacheStrategy());
// Set a cache entry
await cache.set('user:123', JSON.stringify({ name: 'John Doe' }), 3600);
// Get a cache entry
const userData = await cache.get('user:123');
console.log(JSON.parse(userData || '{}'));
// Delete a cache entry
await cache.delete('user:123');🛠 API Reference
CacheManager
| Method | Description |
| ------------------------------- | ------------------------------------------------------------------------------------ |
| set(key, value, cache?, ttl?) | Stores a value in cache with optional cache (default = true), TTL (default = 3600ms) |
| get(key) | Retrieves a value from cache |
| delete(key) | Removes a key from cache |
| getStats() | Returns cache hit/miss statistics |
🏗 Roadmap
- [ ] Add Visualization for stats
- [ ] Add support for in-memory caching
- [ ] Implement a multi-cache strategy
- [ ] Performance benchmarking
🏆 Contributing
We welcome contributions! Please check out our CONTRIBUTING.md.
📜 License
This project is licensed under the MIT License.
