{"id":16644170,"url":"https://github.com/75lb/cache-point","last_synced_at":"2025-10-24T15:42:09.550Z","repository":{"id":57192483,"uuid":"64038071","full_name":"75lb/cache-point","owner":"75lb","description":"Simple, filesystem-backed memoisation cache.","archived":false,"fork":false,"pushed_at":"2024-12-06T00:06:30.000Z","size":80,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T02:51:20.032Z","etag":null,"topics":["cache","javascript","javascript-library","memoization","nodejs"],"latest_commit_sha":null,"homepage":"","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/75lb.png","metadata":{"files":{"readme":"README.hbs","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-23T22:11:52.000Z","updated_at":"2024-12-06T00:06:32.000Z","dependencies_parsed_at":"2024-10-12T08:20:45.159Z","dependency_job_id":null,"html_url":"https://github.com/75lb/cache-point","commit_stats":{"total_commits":46,"total_committers":1,"mean_commits":46.0,"dds":0.0,"last_synced_commit":"438eefe196ad9d8c7687e1c774c51245c2551a96"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcache-point","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcache-point/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcache-point/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcache-point/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/75lb","download_url":"https://codeload.github.com/75lb/cache-point/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244822753,"owners_count":20516159,"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":["cache","javascript","javascript-library","memoization","nodejs"],"created_at":"2024-10-12T08:10:39.104Z","updated_at":"2025-10-24T15:42:09.455Z","avatar_url":"https://github.com/75lb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![view on npm](https://badgen.net/npm/v/cache-point)](https://www.npmjs.org/package/cache-point)\n[![npm module downloads](https://badgen.net/npm/dt/cache-point)](https://www.npmjs.org/package/cache-point)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/cache-point)](https://github.com/75lb/cache-point/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/cache-point)](https://github.com/75lb/cache-point/network/dependents?dependent_type=PACKAGE)\n[![Node.js CI](https://github.com/75lb/cache-point/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/cache-point/actions/workflows/node.js.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n# cache-point\n\nSimple, filesystem-backed memoisation cache. Use to cache the output of expensive operations speeding up future invocations with the same input.\n\n## Synopsis\n\n```js\nimport Cache from 'cache-point'\nimport { setTimeout as sleep } from 'node:timers/promises'\n\n/* mock function to simulate a slow, remote request */\nasync function fetchUser (id) {\n  await sleep(1000)\n  return { id, name: 'Layla' }\n}\n\nclass Users {\n  constructor () {\n    this.cache = new Cache({ dir: 'tmp/example' })\n  }\n\n  async getUser (id) {\n    let user\n    try {\n      /* cache.read() will resolve on hit, reject on miss */\n      user = await this.cache.read(id)\n    } catch (err) {\n      if (err.code === 'ENOENT') {\n        /* cache miss, fetch remote user */\n        user = await fetchUser(id)\n        this.cache.write(id, user)\n      }\n    }\n    return user\n  }\n}\n\nconsole.time('getUser')\nconst users = new Users()\nconst user = await users.getUser(10)\nconsole.timeEnd('getUser')\nconsole.log(user)\n```\n\nThe first invocation will take 1 second while the remote user is fetched.\n\n```\n$ node example/simple.js\ngetUser: 1.025s\n{ id: 10, name: 'Layla' }\n```\n\nSince the cache is now warm, future invocations will be fast.\n\n```\n$ node example/simple.js\ngetUser: 17.07ms\n{ id: 10, name: 'Layla' }\n```\n\n## API Reference\n\n{{\u003emain}}\n\n* * *\n\n\u0026copy; 2016-25 Lloyd Brookes \\\u003copensource@75lb.com\\\u003e.\n\nTested by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fcache-point","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F75lb%2Fcache-point","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fcache-point/lists"}