{"id":26730804,"url":"https://github.com/cevr/pausa","last_synced_at":"2025-07-12T03:10:31.828Z","repository":{"id":235577949,"uuid":"636449297","full_name":"cevr/pausa","owner":"cevr","description":"A simple React.Suspense Cache","archived":false,"fork":false,"pushed_at":"2024-08-15T20:42:45.000Z","size":183,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-15T22:29:00.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/cevr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-05-04T21:53:19.000Z","updated_at":"2024-08-15T20:42:49.000Z","dependencies_parsed_at":"2024-04-23T22:34:08.127Z","dependency_job_id":"d9d1ee5e-57d3-418c-8c05-917e8ebd8a0c","html_url":"https://github.com/cevr/pausa","commit_stats":null,"previous_names":["cevr/pausa"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevr%2Fpausa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevr%2Fpausa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevr%2Fpausa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevr%2Fpausa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cevr","download_url":"https://codeload.github.com/cevr/pausa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245944020,"owners_count":20697945,"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":"2025-03-27T23:32:00.445Z","updated_at":"2025-03-27T23:33:40.355Z","avatar_url":"https://github.com/cevr.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Inspired by [Brian's](https://twitter.com/brian_d_vaughn) work in [Suspense](https://github.com/bvaughn/suspense)\n\n**Pausa** is a simple and powerful React library designed to optimize your application's performance with effortless caching mechanisms built on top of React's Suspense.\n\nPausa makes it easier to manage and reuse data across your components, improving efficiency and reducing redundant network requests.\n\n## 🚀 Features\n\n- **Efficient Caching**: Automatically cache resolved data, reducing the need for repetitive requests.\n- **Flexible TTL**: Customize Time-to-Live (TTL) for cached data to match your application's needs.\n- **Automatic Invalidation**: Supports fine-grained cache invalidation to keep your data fresh.\n- **Resource Management**: Manage multiple resources with ease using our intuitive API.\n- **Optimistic Updates**: Seamlessly update your UI with optimistic data handling.\n\n## 📦 Installation\n\nTo start using Pausa in your React project, install it via npm or yarn:\n\n```bash\nnpm install pausa\n```\n\nor\n\n```bash\nyarn add pausa\n```\n\n## 🛠️ Usage\n\nPausa integrates directly into your React components, allowing you to cache data and manage Suspense boundaries with ease. Here's a quick example:\n\n```javascript\nimport React, { Suspense } from \"react\";\nimport { cache } from \"pausa\";\n\nconst dataCache = cache(async (context, key) =\u003e {\n  const response = await fetch(`/api/data/\\${key}`);\n  return response.json();\n});\n\nfunction MyComponent({ dataKey }) {\n  const data = dataCache.use(dataKey);\n  return \u003cdiv\u003e{data.name}\u003c/div\u003e;\n}\n\nfunction App() {\n  return (\n    \u003cSuspense fallback={\u003cdiv\u003eLoading...\u003c/div\u003e}\u003e\n      \u003cMyComponent dataKey=\"123\" /\u003e\n    \u003c/Suspense\u003e\n  );\n}\n```\n\n## 📚 API Reference\n\n- **`cache(loadFunction, options)`**: Creates a new cache with the provided load function and options.\n- **`cache.use(key)`**: Retrieves the cached data for the specified key, suspending if not yet resolved.\n- **`cache.invalidate(key)`**: Invalidates the cached data for the specified key.\n- **`cache.set(key, value)`**: Manually sets the cached value for a specific key.\n\nFor detailed API documentation, refer to the [full documentation](#).\n\n## 🤝 Contributing\n\nWe welcome contributions! To get started:\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature/my-feature`).\n3. Make your changes and commit (`git commit -m 'Add new feature'`).\n4. Push to the branch (`git push origin feature/my-feature`).\n5. Open a pull request.\n\nPlease make sure to update tests as appropriate.\n\n## 📄 License\n\nPausa is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcevr%2Fpausa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcevr%2Fpausa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcevr%2Fpausa/lists"}