1.0.5 • Published 10 months ago
@nsx07/rush v1.0.5
RUSH - Memoization with Persistent Caching 🚀
RUSH is a lightweight TypeScript library designed to simplify caching and memoization in your applications. It provides an easy-to-use decorator for memoizing method results and manages persistent storage using sessionStorage or localStorage. Perfect for optimizing performance by avoiding redundant computations!
Key Features ✨
- Memoization: Cache method results to avoid repeated executions.
- Persistent Storage: Store cached data in
sessionStorageorlocalStorage. - TTL Support: Set a time-to-live (TTL) for cached data.
- Decorators: Simple and intuitive decorators for memoization and cache tracking.
Why Use RUSH? 🎯
- Client-Side Focus: Built specifically for browser environments.
- Serializable Data: Ensures compatibility with persistent storage by supporting only serializable data structures.
- Flexible Configuration: Customize cache keys, TTL, and storage providers.
Quick Start 🚀
Install via npm:
npm install @nsx07/rushUse the Memoize decorator to cache method results:
import { Memoize, TTLCommon } from "@nsx07/rush";
class MyService {
@Memoize({ ttl: TTLCommon.ONE_MINUTE })
async fetchData(id: string): Promise<string> {
console.log("Fetching data...");
return `Data for ${id}`;
}
}Get Started Today! 🌟
Optimize your app's performance with RUSH.