LRU Cache
Keeps cached data in memory using LRU Cache.
Usage
Driver name: lru-cache
Keeps cached data in memory using LRU Cache.
Make sure to install the required dependency:
npm i lru-cache
yarn add lru-cache
pnpm i lru-cache
bun i lru-cache
deno i npm:lru-cache
See lru-cache for supported options.
By default, max setting is set to 1000 items.
A default behavior for sizeCalculation option is implemented based on buffer size of both key and value.
import { createStorage } from "unstorage";
import lruCacheDriver from "unstorage/drivers/lru-cache";
const storage = createStorage({
driver: lruCacheDriver(),
});