Skip to content

createMemoryCache

createMemoryCache(maxSize, now?): CacheStore

Defined in: packages/fetch-kit/src/cache.ts:14

In-memory LRU cache used as the default response cache store.

Combines time-based expiry with size-based eviction. Reads of an expired entry remove it eagerly. Inserts past maxSize evict the least-recently-used entry. Implemented on top of Map whose iteration order is insertion order; re-inserting a key on hit moves it to the most-recently-used position.

Exposed so callers can compose it with their own logic (e.g. wrap with persistence, or pre-warm the cache).

number

() => number

CacheStore