throttle-async-function (v1.2.0) is an npm package that caches the results of async function calls based on arguments, effectively throttling execution by serving cached results for repeated calls. It offers configurable cache refresh period, max age, LRU eviction, retry on failure, and hit rate reporting. Unlike simple memoization libraries, it includes a cache refresh mechanism that proactively re-fetches data while still serving stale results, and exposes utilities like callWithoutCache and clearCache. The package has a low release cadence with no major changes since initial release.
npm install throttle-async-functionNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a throttled async function with caching, shows cache reuse, force refresh, and cache clearing.
For actual rate limiting, use a dedicated throttle package like p-limit.
Ensure your async function handles errors and does not throw for expected failures.
Always specify options explicitly to avoid relying on default values.
Use default import: import throttleAsyncFunction from 'throttle-async-function'
Install lru-cache explicitly: npm install lru-cache