UNPKG

shohan

Version:

Production-grade utilities and tools by Shohan - Starting with Smart Cache System for Next.js applications

49 lines (41 loc) โ€ข 2.37 kB
# Changelog All notable changes to @shohan/cache will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [1.0.0] - 2025-06-25 ### Added - ๐Ÿš€ Initial release of @shohan/cache - ๐Ÿ—๏ธ Production-grade 3-layer cache architecture (Memory โ†’ Redis โ†’ Database) - ๐Ÿง  Intelligent traffic detection with automatic threshold adjustment - โšก Smart TTL management (Redis gets 10x memory TTL for optimal persistence) - ๐Ÿ”ง Zero-configuration setup with graceful Redis fallback - ๐Ÿ“Š Comprehensive metrics and monitoring system - ๐Ÿ›ก๏ธ Circuit breaker pattern for Redis failures - ๐ŸŽฏ TypeScript-first API with intelligent defaults - ๐Ÿ“ˆ Performance optimizations achieving 2-5ms response times - ๐Ÿ”„ Automatic cache invalidation and cleanup - ๐Ÿ“š Framework examples for Next.js, Express, Prisma, MongoDB - ๐Ÿ” Advanced debugging and logging capabilities - ๐Ÿšฆ Robust error handling that never breaks applications - โš™๏ธ Flexible configuration options via environment variables - ๐Ÿ“Š Real-time cache statistics and health monitoring - ๐Ÿงช Built-in testing and validation tools ### Features - **Smart Caching**: Only caches when beneficial (5+ req/min in dev, 100+ in production) - **Hybrid Architecture**: Memory + Redis + Database with automatic failover - **Per-Endpoint Control**: Individual traffic thresholds and TTL management - **Framework Agnostic**: Works with Next.js, Express, any Node.js application - **Database Agnostic**: Supports Prisma, MongoDB, MySQL, PostgreSQL, any async operation - **Zero Dependencies**: Core functionality works without Redis - **Production Ready**: 90%+ database load reduction, enterprise-grade reliability ### Performance - โšก Memory cache hits: ~2ms response time - ๐Ÿ’พ Redis cache hits: ~25ms response time - ๐Ÿ—„๏ธ Database reduction: 90%+ less load - ๐Ÿ“Š Efficiency score: Real-time performance monitoring - ๐Ÿ”„ Automatic optimization: Self-tuning based on traffic patterns ### Configuration - Environment variable based configuration - Multiple cache strategies: aggressive, balanced, conservative, memory-only - Automatic fallback modes for different deployment scenarios - Fine-grained control over TTL, traffic thresholds, and caching behavior