{"_id":"promise-coalesce","_rev":"6-2acff184ced2c6179d1d3d2cf411743a","name":"promise-coalesce","dist-tags":{"latest":"1.5.0"},"versions":{"1.0.0":{"name":"promise-coalesce","version":"1.0.0","keywords":["promise","coalesce","async"],"author":{"url":"https://github.com/douglascayers","name":"Doug Ayers"},"license":"BSD-3-Clause","_id":"promise-coalesce@1.0.0","maintainers":[{"name":"douglascayers","email":"douglascayers@gmail.com"}],"homepage":"https://github.com/douglascayers/promise-coalesce#readme","bugs":{"url":"https://github.com/douglascayers/promise-coalesce/issues"},"dist":{"shasum":"cb2fe2308ed2ed760afb5161a9e2bed429cff193","tarball":"https://registry.npmjs.org/promise-coalesce/-/promise-coalesce-1.0.0.tgz","fileCount":12,"integrity":"sha512-76gYrTHcnDNI0b8KDIVXhiCKrDDWHjhnjUgl+nhXQEF/Htp9MspV32H1iryXAjR4tiZ753t1EHOaFeDHjlOjXA==","signatures":[{"sig":"MEQCIGbugg9BZQD8pPUobup0/U+uAB+Agau7aLNPPEO3TSStAiBfCkJW69B93hHZ5qITPyLcspewQZxTdSdcjWVBxqcPpg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11814},"types":"./dist/index.d.ts","engines":{"node":">=16"},"exports":"./dist/index.js","gitHead":"59dce01023267181aa5d284e3cc4b85c18403abd","release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/git","@semantic-release/github"],"branches":["main"]},"scripts":{"lint":"eslint --ext .ts,.tsx,.js,.json .","test":"jest","build":"yarn clean && tsc","clean":"rm -rf dist && rm -rf coverage","format":"yarn prettier:fix && yarn lint:fix","prepare":"yarn build","lint:fix":"yarn lint --fix","prettier":"prettier --check --ignore-unknown --no-error-on-unmatched-pattern .","lint:staged":"lint-staged --concurrent 1","postinstall":"husky install","prettier:fix":"yarn prettier --write","semantic-release":"semantic-release"},"_npmUser":{"name":"douglascayers","email":"douglascayers@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/douglascayers/promise-coalesce.git"},"_npmVersion":"10.1.0","description":"Coalesces multiple promises for the same identifier into a single request.","directories":{},"lint-staged":{"*":"yarn prettier:fix","*.{ts,tsx,js,json}":"yarn lint:fix"},"_nodeVersion":"18.18.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^8.0.3","eslint":"^8.50.0","ts-jest":"^29.1.1","ts-node":"^10.9.1","prettier":"^3.0.3","typescript":"^5.2.2","@types/jest":"^29.5.5","@types/node":"^18.17.19","lint-staged":"^14.0.1","@commitlint/cli":"^17.7.2","semantic-release":"^22.0.5","eslint-plugin-import":"^2.28.1","@semantic-release/git":"^10.0.1","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.0","@typescript-eslint/parser":"^6.7.3","@semantic-release/changelog":"^6.0.3","eslint-plugin-unused-imports":"^3.0.0","@commitlint/config-conventional":"^17.7.0","@typescript-eslint/eslint-plugin":"^6.7.3"},"_npmOperationalInternal":{"tmp":"tmp/promise-coalesce_1.0.0_1696055519619_0.06559842318553333","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"promise-coalesce","version":"1.1.0","keywords":["promise","coalesce","async"],"author":{"url":"https://github.com/douglascayers","name":"Doug Ayers"},"license":"BSD-3-Clause","_id":"promise-coalesce@1.1.0","maintainers":[{"name":"douglascayers","email":"douglascayers@gmail.com"}],"homepage":"https://github.com/douglascayers/promise-coalesce#readme","bugs":{"url":"https://github.com/douglascayers/promise-coalesce/issues"},"dist":{"shasum":"c7fcdaaa44044eb44c0982f7b2971cfa41299cba","tarball":"https://registry.npmjs.org/promise-coalesce/-/promise-coalesce-1.1.0.tgz","fileCount":12,"integrity":"sha512-KhoxPu2XffFNuJlM0G7TlIlDEQAEFd7G/IJhWDT6ISo3IAqFI4DAlMgzkQatzCXV0PmI3q2ENZm1GCTUwRJ9fQ==","signatures":[{"sig":"MEUCIFULbC5wOGErUIffzrnCsXwdr1C9cDJTPjAlc95H+oC0AiEA1vmGZiOg4/4qukq5K0r1NLJ0tKK608D0oXwSsRDxjvM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11799},"types":"./dist/index.d.ts","engines":{"node":">=16"},"exports":"./dist/index.js","gitHead":"5ff083288f2863eb1abb9f9d67b51f9a79b61641","release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/git","@semantic-release/github"],"branches":["main"]},"scripts":{"lint":"eslint --ext .ts,.tsx,.js,.json .","test":"jest","build":"yarn clean && tsc","clean":"rm -rf dist && rm -rf coverage","format":"yarn prettier:fix && yarn lint:fix","prepare":"yarn build && npx husky install","lint:fix":"yarn lint --fix","prettier":"prettier --check --ignore-unknown --no-error-on-unmatched-pattern .","lint:staged":"lint-staged --concurrent 1","prettier:fix":"yarn prettier --write","semantic-release":"semantic-release"},"_npmUser":{"name":"douglascayers","email":"douglascayers@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/douglascayers/promise-coalesce.git"},"_npmVersion":"10.1.0","description":"Coalesces multiple promises for the same identifier into a single request.","directories":{},"lint-staged":{"*":"yarn prettier:fix","*.{ts,tsx,js,json}":"yarn lint:fix"},"_nodeVersion":"18.18.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^8.0.3","eslint":"^8.50.0","ts-jest":"^29.1.1","ts-node":"^10.9.1","prettier":"^3.0.3","typescript":"^5.2.2","@types/jest":"^29.5.5","@types/node":"^18.17.19","lint-staged":"^14.0.1","@commitlint/cli":"^17.7.2","semantic-release":"^22.0.5","eslint-plugin-import":"^2.28.1","@semantic-release/git":"^10.0.1","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.0","@typescript-eslint/parser":"^6.7.3","@semantic-release/changelog":"^6.0.3","eslint-plugin-unused-imports":"^3.0.0","@commitlint/config-conventional":"^17.7.0","@typescript-eslint/eslint-plugin":"^6.7.3"},"_npmOperationalInternal":{"tmp":"tmp/promise-coalesce_1.1.0_1696128617638_0.2587908979990887","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"promise-coalesce","version":"1.1.1","keywords":["promise","coalesce","async"],"author":{"url":"https://github.com/douglascayers","name":"Doug Ayers"},"license":"BSD-3-Clause","_id":"promise-coalesce@1.1.1","maintainers":[{"name":"douglascayers","email":"douglascayers@gmail.com"}],"homepage":"https://github.com/douglascayers/promise-coalesce#readme","bugs":{"url":"https://github.com/douglascayers/promise-coalesce/issues"},"dist":{"shasum":"01f0d4c06060507fb0ca1f1cca8fa90ada1e22ba","tarball":"https://registry.npmjs.org/promise-coalesce/-/promise-coalesce-1.1.1.tgz","fileCount":12,"integrity":"sha512-k7+VaIwZc5dRfSF6RELqRY1+LCmcCkrnuNV9HzIpA6iwRHKke+j9yb0LBTTHQ2RRgf6AlMl9TntuTzcgV/BZwg==","signatures":[{"sig":"MEYCIQDRPvaA2M/qPVTAYc1yboDlLolVU4JL3aKc9TgUEmVoTQIhAPMXCeqZ7yUC1TmcArda0IFXiKH7WaeSRdakKs2kWv8s","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12420},"types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":"./dist/index.js","gitHead":"97494d1e31372dfb3445105afcb808b030f38297","release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/git","@semantic-release/github"],"branches":["main"]},"scripts":{"lint":"eslint --ext .ts,.tsx,.js,.json .","test":"jest","build":"yarn clean && tsc","clean":"rm -rf dist && rm -rf coverage","format":"yarn prettier:fix && yarn lint:fix","prepare":"yarn build && npx husky install","lint:fix":"yarn lint --fix","prettier":"prettier --check --ignore-unknown --no-error-on-unmatched-pattern .","lint:staged":"lint-staged --concurrent 1","prettier:fix":"yarn prettier --write","semantic-release":"semantic-release"},"_npmUser":{"name":"douglascayers","email":"douglascayers@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/douglascayers/promise-coalesce.git"},"_npmVersion":"10.1.0","description":"Coalesces multiple promises for the same identifier into a single request","directories":{},"lint-staged":{"*":"yarn prettier:fix","*.{ts,tsx,js,json}":"yarn lint:fix"},"_nodeVersion":"18.18.2","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^8.0.3","eslint":"^8.52.0","ts-jest":"^29.1.1","ts-node":"^10.9.1","prettier":"^3.0.3","typescript":"^5.2.2","@types/jest":"^29.5.6","@types/node":"^18.17.19","lint-staged":"^15.0.2","@commitlint/cli":"^18.0.0","semantic-release":"^22.0.5","eslint-plugin-import":"^2.29.0","@semantic-release/git":"^10.0.1","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.1","@typescript-eslint/parser":"^6.9.0","@semantic-release/changelog":"^6.0.3","eslint-plugin-unused-imports":"^3.0.0","@commitlint/config-conventional":"^18.0.0","@typescript-eslint/eslint-plugin":"^6.9.0"},"_npmOperationalInternal":{"tmp":"tmp/promise-coalesce_1.1.1_1698198557386_0.5804762792797205","host":"s3://npm-registry-packages"}},"1.1.2":{"name":"promise-coalesce","version":"1.1.2","keywords":["promise","coalesce","async"],"author":{"url":"https://github.com/douglascayers","name":"Doug Ayers"},"license":"BSD-3-Clause","_id":"promise-coalesce@1.1.2","maintainers":[{"name":"douglascayers","email":"douglascayers@gmail.com"}],"homepage":"https://github.com/douglascayers/promise-coalesce#readme","bugs":{"url":"https://github.com/douglascayers/promise-coalesce/issues"},"dist":{"shasum":"5d3bc4d0b2cf2e41e9df7cbeb6519b2a09459e3d","tarball":"https://registry.npmjs.org/promise-coalesce/-/promise-coalesce-1.1.2.tgz","fileCount":12,"integrity":"sha512-zLaJ9b8hnC564fnJH6NFSOGZYYdzrAJn2JUUIwzoQb32fG2QAakpDNM+CZo1km6keXkRXRM+hml1BFAPVnPkxg==","signatures":[{"sig":"MEUCIQDk0HVQyfrXwaCXmao9PEZy+SQdAFmk5KABkNsw1kSmGwIgbJ4OvOUlgVatLDYhHv4bpyDIgPve54atIruPvtIrjmM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12420},"types":"./dist/index.d.ts","engines":{"node":">=16"},"exports":"./dist/index.js","gitHead":"f9d29734628ba5a2e61453d2df5246485d792dce","release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/git","@semantic-release/github"],"branches":["main"]},"scripts":{"lint":"eslint --ext .ts,.tsx,.js,.json .","test":"jest","build":"yarn clean && tsc","clean":"rm -rf dist && rm -rf coverage","format":"yarn prettier:fix && yarn lint:fix","prepare":"yarn build && npx husky install","lint:fix":"yarn lint --fix","prettier":"prettier --check --ignore-unknown --no-error-on-unmatched-pattern .","lint:staged":"lint-staged --concurrent 1","prettier:fix":"yarn prettier --write","semantic-release":"semantic-release"},"_npmUser":{"name":"douglascayers","email":"douglascayers@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/douglascayers/promise-coalesce.git"},"_npmVersion":"10.1.0","description":"Coalesces multiple promises for the same identifier into a single request","directories":{},"lint-staged":{"*":"yarn prettier:fix","*.{ts,tsx,js,json}":"yarn lint:fix"},"_nodeVersion":"18.19.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^8.0.3","eslint":"^8.52.0","ts-jest":"^29.1.1","ts-node":"^10.9.1","prettier":"^3.0.3","typescript":"^5.2.2","@types/jest":"^29.5.6","@types/node":"^18.17.19","lint-staged":"^15.0.2","@commitlint/cli":"^18.0.0","semantic-release":"^22.0.5","eslint-plugin-import":"^2.29.0","@semantic-release/git":"^10.0.1","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.1","@typescript-eslint/parser":"^6.9.0","@semantic-release/changelog":"^6.0.3","eslint-plugin-unused-imports":"^3.0.0","@commitlint/config-conventional":"^18.0.0","@typescript-eslint/eslint-plugin":"^6.9.0"},"_npmOperationalInternal":{"tmp":"tmp/promise-coalesce_1.1.2_1702955042599_0.16369499879146088","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"promise-coalesce","version":"1.3.0","keywords":["promise","coalesce","async"],"author":{"url":"https://github.com/douglascayers","name":"Doug Ayers"},"license":"BSD-3-Clause","_id":"promise-coalesce@1.3.0","maintainers":[{"name":"douglascayers","email":"douglascayers@gmail.com"}],"homepage":"https://github.com/douglascayers/promise-coalesce#readme","bugs":{"url":"https://github.com/douglascayers/promise-coalesce/issues"},"dist":{"shasum":"1a5f3b966b29c976ff2d49f71d913ec56e05ca4b","tarball":"https://registry.npmjs.org/promise-coalesce/-/promise-coalesce-1.3.0.tgz","fileCount":9,"integrity":"sha512-2zaNnXKuGsUkkwC9S+3RHDgeHkvkaUVLPMJb9k9+Fg/wC14RwnMgm1HCZ1hU4EByv3Z8t8E58IVZFJHdNQYKhw==","signatures":[{"sig":"MEYCIQC8C8R7fCf6NvJwPfffYkfG8fIeauNM5Y5qGo6sEAjfrgIhANMBZTQc3qmnt9nVuyj7+HU63Q/Jf+hKrKlsShvL9wFN","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10093},"types":"./dist/index.d.ts","engines":{"node":">=16"},"exports":"./dist/index.js","gitHead":"07f6903f95035b364b8081c6a95b107d62b1875a","release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/git","@semantic-release/github"],"branches":["main"]},"scripts":{"lint":"eslint --ext .ts,.tsx,.js,.json .","test":"jest","build":"yarn clean && tsc","clean":"rm -rf dist && rm -rf coverage","format":"yarn prettier:fix && yarn lint:fix","prepare":"yarn build && npx husky install","lint:fix":"yarn lint --fix","prettier":"prettier --check --ignore-unknown --no-error-on-unmatched-pattern .","lint:staged":"lint-staged --concurrent 1","prettier:fix":"yarn prettier --write","semantic-release":"semantic-release"},"_npmUser":{"name":"douglascayers","email":"douglascayers@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/douglascayers/promise-coalesce.git"},"_npmVersion":"11.6.2","description":"Coalesces multiple promises for the same identifier into a single request","directories":{},"lint-staged":{"*":"yarn prettier:fix","*.{ts,tsx,js,json}":"yarn lint:fix"},"_nodeVersion":"20.19.2","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^8.0.3","eslint":"^8.52.0","ts-jest":"^29.1.1","ts-node":"^10.9.1","prettier":"^3.0.3","typescript":"^5.2.2","@types/jest":"^29.5.6","@types/node":"^18.17.19","lint-staged":"^15.0.2","@commitlint/cli":"^18.0.0","semantic-release":"^22.0.5","eslint-plugin-import":"^2.29.0","@semantic-release/git":"^10.0.1","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.1","@typescript-eslint/parser":"^6.9.0","@semantic-release/changelog":"^6.0.3","eslint-plugin-unused-imports":"^3.0.0","@commitlint/config-conventional":"^18.0.0","@typescript-eslint/eslint-plugin":"^6.9.0"},"_npmOperationalInternal":{"tmp":"tmp/promise-coalesce_1.3.0_1762578270444_0.7268198478609622","host":"s3://npm-registry-packages-npm-production"}},"1.5.0":{"name":"promise-coalesce","version":"1.5.0","description":"Coalesces multiple promises for the same identifier into a single request","keywords":["promise","coalesce","async"],"author":{"name":"Doug Ayers","url":"https://github.com/douglascayers"},"repository":{"url":"git+https://github.com/douglascayers/promise-coalesce.git"},"bugs":{"url":"https://github.com/douglascayers/promise-coalesce/issues"},"homepage":"https://github.com/douglascayers/promise-coalesce#readme","license":"BSD-3-Clause","scripts":{"clean":"rm -rf dist && rm -rf coverage","prettier":"prettier --check --ignore-unknown --no-error-on-unmatched-pattern .","prettier:fix":"yarn prettier --write","lint":"eslint --ext .ts,.tsx,.js,.json .","lint:fix":"yarn lint --fix","lint:staged":"lint-staged --concurrent 1","format":"yarn prettier:fix && yarn lint:fix","build":"yarn clean && tsc","prepare":"yarn build && npx husky install","test":"jest","semantic-release":"semantic-release"},"release":{"branches":["main"],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/git","@semantic-release/github"]},"exports":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=16"},"dependencies":{},"devDependencies":{"@commitlint/cli":"^18.0.0","@commitlint/config-conventional":"^18.0.0","@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@types/jest":"^29.5.6","@types/node":"^18.17.19","@typescript-eslint/eslint-plugin":"^6.9.0","@typescript-eslint/parser":"^6.9.0","eslint":"^8.52.0","eslint-config-prettier":"^9.0.0","eslint-plugin-import":"^2.29.0","eslint-plugin-prettier":"^5.0.1","eslint-plugin-unused-imports":"^3.0.0","husky":"^8.0.3","jest":"^29.7.0","lint-staged":"^15.0.2","prettier":"^3.0.3","semantic-release":"^22.0.5","ts-jest":"^29.1.1","ts-node":"^10.9.1","typescript":"^5.2.2"},"commitlint":{"extends":["@commitlint/config-conventional"]},"lint-staged":{"*.{ts,tsx,js,json}":"yarn lint:fix","*":"yarn prettier:fix"},"_id":"promise-coalesce@1.5.0","gitHead":"2626e1df9084db32748e530ec1eca65f78e198ee","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-cTJ30U+ur1LD7pMPyQxiKIwxjtAjLsyU7ivRhVWZrX9BNIXtf78pc37vSMc8Vikx7DVzEKNk2SEJ5KWUpSG2ig==","shasum":"f840f2f5bec61468e659a9b7c269e173a663c4a1","tarball":"https://registry.npmjs.org/promise-coalesce/-/promise-coalesce-1.5.0.tgz","fileCount":9,"unpackedSize":10093,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFAeGca8KQhVjkWMkRSgZ+8zaYU26ORbdJqH5wk1PV6iAiEAyJNgst2+8vTrACVmOXP0GJbfgtXrgoF05Efv7xDqISI="}]},"_npmUser":{"name":"douglascayers","email":"douglascayers@gmail.com"},"directories":{},"maintainers":[{"name":"douglascayers","email":"douglascayers@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/promise-coalesce_1.5.0_1762578727779_0.6876571936898153"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-30T06:31:59.618Z","modified":"2025-11-08T05:12:08.190Z","1.0.0":"2023-09-30T06:31:59.792Z","1.1.0":"2023-10-01T02:50:17.887Z","1.1.1":"2023-10-25T01:49:17.604Z","1.1.2":"2023-12-19T03:04:02.821Z","1.3.0":"2025-11-08T05:04:30.689Z","1.5.0":"2025-11-08T05:12:07.965Z"},"bugs":{"url":"https://github.com/douglascayers/promise-coalesce/issues"},"author":{"name":"Doug Ayers","url":"https://github.com/douglascayers"},"license":"BSD-3-Clause","homepage":"https://github.com/douglascayers/promise-coalesce#readme","keywords":["promise","coalesce","async"],"repository":{"url":"git+https://github.com/douglascayers/promise-coalesce.git"},"description":"Coalesces multiple promises for the same identifier into a single request","maintainers":[{"name":"douglascayers","email":"douglascayers@gmail.com"}],"readme":"## promise-coalesce\n\nCoalesces multiple promises for the same identifier into a single request.\n\nReduces load on downstream systems when requests occur at the same time,\nwithout dropping requests or needing exclusion locks or wait-and-retry attempts.\n\n## Install\n\nWith npm:\n\n```sh\nnpm install promise-coalesce\n```\n\nWith yarn:\n\n```sh\nyarn add promise-coalesce\n```\n\n## Usage\n\n```ts\nimport { coalesceAsync } from 'promise-coalesce';\n\nawait coalesceAsync('some-group-key', async () => {\n  /* your logic */\n});\n```\n\n## Example\n\n**Cache Miss Relief Buffer**\n\n```ts\nimport { coalesceAsync } from 'promise-coalesce';\n\n// Imagine you want to retrieve a value, and you have a cache to speed things up.\n// If the value isn't in the cache, you'll need to get it from the source system,\n// which can be a time-consuming process like a database query or an API request.\nasync function getValue(cacheKey: string): Promise<YourData> {\n  // When multiple requests try to fetch the same value from the cache at the same time,\n  // because of the way async operations work, yielding the event loop at each `await`,\n  // then they will all try to get it from the cache.\n  let cachedValue = await cache.get(cacheKey);\n  // They will take turns checking the condition and all see that the value is missing.\n  if (!cachedValue) {\n    // Here's where `coalesceAsync` comes to the rescue!\n    // Instead of making multiple expensive calls to the source system,\n    // we use `coalesceAsync`` to ensure it's called only once, and other requests\n    // wanting the same cache key wait for the result.\n    cachedValue = await coalesceAsync<YourData>(cacheKey, async () => {\n      // Now, we fetch the value from the source system.\n      const sourceValue = await getSourceValue();\n      // We also cache it for future use.\n      await cache.set(cacheKey, sourceValue, ttl);\n      // Now, the value is in the cache, and future requests will avoid calling the source system\n      // until the cached data expires (based on TTL).\n      return sourceValue;\n    });\n  }\n  return cachedValue;\n}\n```\n\n## Credits\n\nThis solution is inspired by [node-cache-manager](https://github.com/node-cache-manager/node-cache-manager)'s\n[CallbackFiller](https://github.com/node-cache-manager/node-cache-manager/blob/4.1.0/lib/callback_filler.js) from the `v4.x` line.\n\nIt was [removed](https://github.com/node-cache-manager/node-cache-manager/issues/417)\nin the `v5.x` line, and `promise-coalesce` is an attempt to recover that feature\nwhile also being generic enough for other applications.\n","readmeFilename":"README.md"}