--- title: "@std/cache" description: "Cache utilities" jsr: jsr:@std/cache pkg: cache version: 0.2.2 generated: true stability: unstable --- :::info Unstable This @std package is experimental and its API may change without a major version bump. ::: ## Overview

In-memory cache utilities, such as memoization and caches with different expiration policies.

```js import { memoize, LruCache, type MemoizationCacheResult } from "@std/cache"; import { assertEquals } from "@std/assert"; const cache = new LruCache>(1000); // fibonacci function, which is very slow for n > ~30 if not memoized const fib = memoize((n: bigint): bigint => { return n <= 2n ? 1n : fib(n - 1n) + fib(n - 2n); }, { cache }); assertEquals(fib(100n), 354224848179261915075n); ``` ### Add to your project ```sh deno add jsr:@std/cache ``` See all symbols in @std/cache on