Skip to content

Start

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.

To install the Cache class, you can use npm, yarn, pnpm or bun:

Terminal window
npm install @hedystia/cache
yarn add @hedystia/cache
pnpm install @hedystia/cache
bun add @hedystia/cache
const cache = new Cache<string, number>();
cache.set('one', 1).set('two', 2);
const values = cache.map(val => val * 2); // [2, 4]
const firstValue = cache.first(); // 1

The Cache class inherits all methods from the standard Map but adds additional utility methods for enhanced functionality, such as map, filter, and sort.

  • This project is licensed under the MIT License.