{"id":34794767,"url":"https://github.com/ricohapi/promise-cache-retry","last_synced_at":"2026-05-25T09:35:06.556Z","repository":{"id":62135310,"uuid":"555256441","full_name":"ricohapi/promise-cache-retry","owner":"ricohapi","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-15T15:59:41.000Z","size":1136,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-12-26T21:48:46.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ricohapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-21T08:22:31.000Z","updated_at":"2025-10-21T20:03:59.000Z","dependencies_parsed_at":"2023-02-03T13:00:36.738Z","dependency_job_id":null,"html_url":"https://github.com/ricohapi/promise-cache-retry","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ricohapi/promise-cache-retry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricohapi%2Fpromise-cache-retry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricohapi%2Fpromise-cache-retry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricohapi%2Fpromise-cache-retry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricohapi%2Fpromise-cache-retry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ricohapi","download_url":"https://codeload.github.com/ricohapi/promise-cache-retry/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricohapi%2Fpromise-cache-retry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33469415,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-25T06:32:55.349Z","status":"ssl_error","status_checked_at":"2026-05-25T06:32:35.322Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-25T10:38:32.922Z","updated_at":"2026-05-25T09:35:06.538Z","avatar_url":"https://github.com/ricohapi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# promise-cache-retry\n\n[![NPM Version][npm-image]][npm-url]\n[![license][license-image]][license-url]\n[![GitHub Actions][github-image]][github-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![TypeScript Style Guide][gts-image]][gts-url]\n[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg)](https://github.com/RichardLitt/standard-readme)\n\n## Table of Contents\n\n- [Security](#security)\n- [Background](#background)\n- [Install](#install)\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Security\n\n## Background\n\nIf you simply cache the Promise it will always resolve with an error after an error occurs.\nOn the other hand, retrying within a Promise will leave the Promise unresolved until the error is resolved, blocking further processing.\n\nSo this library works like this: If an error occurs, resolve it as an error, automatically perform retry processing (unless you disable it explicitly), and return the retry result when referencing the cache.\n\n## Install\n\n\n```\nnpm install --save promise-cache-retry\n```\n\n## Usage\n\n```typescript\nimport { PromiseCache } from 'promise-cache-retry';\n\nconst cache = new PromiseCache({\n  promiseGenerator: async () =\u003e {\n    const res = await fetchData(ENDPOINT);\n    return res.data;\n  },\n  options: {\n    maxRetries: 2,\n    minRetryInterval: 3000,\n  },\n});\n\nexport const handler = async () =\u003e {\n  const value = await cache.get();\n}\n```\n\n## Contributing\n\nSee [the contributing file](CONTRIBUTING.md)!\n\nPRs accepted.\n\nSmall note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\n[MIT © RICOH360](./LICENSE)\n\n[github-image]: https://github.com/ricohapi/promise-cache-retry/workflows/Node.js%20CI/badge.svg\n[github-url]: https://github.com/ricohapi/promise-cache-retry/actions\n[prettier-url]: https://prettier.io/\n[gts-image]: https://img.shields.io/badge/code%20style-google-blueviolet.svg\n[gts-url]: https://github.com/google/gts\n[npm-image]: https://img.shields.io/npm/v/promise-cache-retry.svg\n[npm-url]: https://npmjs.org/package/promise-cache-retry\n[license-image]: https://img.shields.io/github/license/ricohapi/promise-cache-retry.svg\n[license-url]: https://github.com/ricohapi/promise-cache-retry/blob/main/LICENSE\n[snyk-image]: https://snyk.io/test/github/ricohapi/promise-cache-retry/badge.svg\n[snyk-url]: https://snyk.io/test/github/ricohapi/promise-cache-retry\n[standardjs-url]: https://www.npmjs.com/package/standard\n[eslint-url]: https://eslint.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricohapi%2Fpromise-cache-retry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricohapi%2Fpromise-cache-retry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricohapi%2Fpromise-cache-retry/lists"}