{"id":17766561,"url":"https://github.com/floatdrop/memorize-promise","last_synced_at":"2025-03-15T13:30:49.865Z","repository":{"id":57294506,"uuid":"43588393","full_name":"floatdrop/memorize-promise","owner":"floatdrop","description":"Cache promise result and update from time to time","archived":false,"fork":false,"pushed_at":"2015-10-05T06:48:52.000Z","size":144,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-07T09:37:13.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/floatdrop.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-03T04:56:33.000Z","updated_at":"2021-08-19T08:51:38.000Z","dependencies_parsed_at":"2022-08-29T08:01:54.145Z","dependency_job_id":null,"html_url":"https://github.com/floatdrop/memorize-promise","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fmemorize-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fmemorize-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fmemorize-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fmemorize-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floatdrop","download_url":"https://codeload.github.com/floatdrop/memorize-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243735797,"owners_count":20339530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-10-26T20:32:26.654Z","updated_at":"2025-03-15T13:30:49.859Z","avatar_url":"https://github.com/floatdrop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memorize-promise [![Build Status](https://travis-ci.org/floatdrop/memorize-promise.svg?branch=master)](https://travis-ci.org/floatdrop/memorize-promise)\n\nSave promise result and update it from time to time.\n\n\n## Install\n\n```\n$ npm install --save memorize-promise\n```\n\n\n## Usage\n\n```js\nconst got = require('got');\nconst memorizePromise = require('memorize-promise');\n\nconst cache = memorizePromise(() =\u003e got('google.com'));\n\ncache.then(res =\u003e console.log(res.body)); // Content 1\ncache.then(res =\u003e console.log(res.body)); // Content 1\n\nsetTimeout(function () {\n\tcache.then(res =\u003e console.log(res.body)); // Content 2\n\tcache.then(res =\u003e console.log(res.body)); // Content 2\n\n\tcache.stop(); // Stops updates\n}, 5005);\n```\n\n\n## API\n\n### memorizePromise(func, [options])\n\n#### func\n\nType: `Function`\n\nFactory of promises. It will be called for new promise with data every `updateInterval` milliseconds.\n\n#### options\n\n##### updateInterval\n\nType: `Number`  \nDefault: `5000`\n\nUpdate interval in milliseconds.\n\n##### ttl\n\nType: `Number`  \nDefault: `60000`\n\nLifetime of update timeout after last hit.\n\n\n## License\n\nMIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2Fmemorize-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloatdrop%2Fmemorize-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2Fmemorize-promise/lists"}