Start
Overview
Section titled “Overview”The Cache class is a generic key-value store that extends the native JavaScript Map object, providing additional utility methods for enhanced functionality. This README provides documentation for the Cache class, including method descriptions, parameters, return types, and usage examples.
Installation
Section titled “Installation”To install the Cache class, you can use npm, yarn, pnpm or bun:
npm install @hedystia/cacheyarn add @hedystia/cachepnpm install @hedystia/cachebun add @hedystia/cacheUsage Examples
Section titled “Usage Examples”Creating an Instance
Section titled “Creating an Instance”const cache = new Cache<string, number>();cache.set('one', 1).set('two', 2);Using Utility Methods
Section titled “Using Utility Methods”const values = cache.map(val => val * 2); // [2, 4]const firstValue = cache.first(); // 1Differences from Standard Map
Section titled “Differences from Standard Map”The Cache class inherits all methods from the standard Map but adds additional utility methods for enhanced functionality, such as map, filter, and sort.
License
Section titled “License”- This project is licensed under the MIT License.