0.0.4 ⢠Published 5 months ago
cache-vision v0.0.4
š 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.