withCache returns a new cached version of the given async function. Subsequent calls with the same arguments will return cached data for the TTL duration.
withCache
Usage: const cachedFetchData = withCache(fetchData, { ttl: 600, tags: ["users"] }); const data = await cachedFetchData(123);
The async function to wrap.
Optional caching parameters.
withCache
returns a new cached version of the given async function. Subsequent calls with the same arguments will return cached data for the TTL duration.Usage: const cachedFetchData = withCache(fetchData, { ttl: 600, tags: ["users"] }); const data = await cachedFetchData(123);