Memoize promise-returning or async functions. p-memoize speeds up repeated calls to asynchronous functions by caching their results. This is especially useful for functions making network requests or performing computationally expensive operations. It supports various caching strategies, including time-to-live (TTL), to manage cache invalidation and prevent stale data. Options include cacheKey, cache, and maxAge. Returns a memoized function.
The p-memoize npm package saw initial activity in 2016, with sporadic releases until 2022, including several major version updates. Release frequency peaked in late 2021. After a period of inactivity, a new major version (8.0.0) was released in August 2025. Overall, the package exhibits an irregular release pattern, with long periods between updates.
P-memoize downloads show strong performance. Downloads surged in early 2024, peaking in October at 5.1 million. While fluctuating, monthly downloads generally remained above 3.4 million. 2025 saw continued high usage, with February exceeding 5.2 million. August 2025's partial data indicates a possible decrease, but the month is not yet complete.