{"id":13727402,"url":"https://github.com/apollographql/apollo-cache-persist","last_synced_at":"2025-05-11T03:45:56.044Z","repository":{"id":38009499,"uuid":"112787739","full_name":"apollographql/apollo-cache-persist","owner":"apollographql","description":"🎏 Simple persistence for all Apollo Cache implementations","archived":false,"fork":false,"pushed_at":"2025-04-28T07:57:02.000Z","size":2172,"stargazers_count":1401,"open_issues_count":33,"forks_count":116,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-04-30T15:11:13.728Z","etag":null,"topics":["apollo","graphql","offline","react-native"],"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/apollographql.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2017-12-01T21:17:07.000Z","updated_at":"2025-04-16T19:17:34.000Z","dependencies_parsed_at":"2023-10-18T08:45:52.800Z","dependency_job_id":"ae9238c8-9c84-43c8-9f9b-675534c9dc05","html_url":"https://github.com/apollographql/apollo-cache-persist","commit_stats":{"total_commits":394,"total_committers":40,"mean_commits":9.85,"dds":"0.48223350253807107","last_synced_commit":"719048da47f9a3885598c3093d02bd1f106bc2de"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apollographql%2Fapollo-cache-persist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apollographql%2Fapollo-cache-persist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apollographql%2Fapollo-cache-persist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apollographql%2Fapollo-cache-persist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apollographql","download_url":"https://codeload.github.com/apollographql/apollo-cache-persist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252522132,"owners_count":21761684,"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":["apollo","graphql","offline","react-native"],"created_at":"2024-08-03T01:03:54.191Z","updated_at":"2025-05-08T01:00:03.814Z","avatar_url":"https://github.com/apollographql.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# apollo3-cache-persist [![npm version](https://badge.fury.io/js/apollo3-cache-persist.svg)](https://badge.fury.io/js/apollo3-cache-persist) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\nSimple persistence for all Apollo Client 3.0 cache implementations, including\n[`InMemoryCache`][0] and [`Hermes`][1].\n\nSupports web and React Native. [See all storage providers.](./docs/storage-providers.md)\n\n[0]: https://github.com/apollographql/apollo-client/tree/master/src/cache/inmemory\n[1]: https://github.com/convoyinc/apollo-cache-hermes\n\n\n- [Basic Usage](#basic-usage)\n  - [React Native](#react-native)\n  - [Web](#web)\n- [Storage Providers](./docs/storage-providers.md)\n- [Advanced Usage](./docs/advanced-usage.md)\n- [FAQ](./docs/faq.md)\n- [Contributing](#contributing)\n- [Maintainers](#maintainers)\n\n## Basic Usage\n\n```sh\nnpm install --save apollo3-cache-persist\n```\n\nor\n\n```sh\nyarn add apollo3-cache-persist\n```\n\nTo get started, simply pass your Apollo cache and an\n[underlying storage provider](./docs/storage-providers.md) to `persistCache`.\n\nBy default, the contents of your Apollo cache will be immediately restored\n(asynchronously, see [how to persist data before rendering](./docs/faq.md#how-do-i-wait-for-the-cache-to-be-restored-before-rendering-my-app)), and will be persisted upon every write to the cache (with a\nshort debounce interval).\n\n### Examples\n\n#### React Native\n\n```js\nimport AsyncStorage from '@react-native-async-storage/async-storage';\nimport { InMemoryCache } from '@apollo/client/core';\nimport { persistCache, AsyncStorageWrapper } from 'apollo3-cache-persist';\n\nconst cache = new InMemoryCache({...});\n\n// await before instantiating ApolloClient, else queries might run before the cache is persisted\nawait persistCache({\n  cache,\n  storage: new AsyncStorageWrapper(AsyncStorage),\n});\n\n// Continue setting up Apollo as usual.\n\nconst client = new ApolloClient({\n  cache,\n  ...\n});\n```\n\n#### Web\n\n```js\nimport { InMemoryCache } from '@apollo/client/core';\nimport { persistCache, LocalStorageWrapper } from 'apollo3-cache-persist';\n\nconst cache = new InMemoryCache({...});\n\n// await before instantiating ApolloClient, else queries might run before the cache is persisted\nawait persistCache({\n  cache,\n  storage: new LocalStorageWrapper(window.localStorage),\n});\n\n// Continue setting up Apollo as usual.\n\nconst client = new ApolloClient({\n  cache,\n  ...\n});\n```\n\nSee a complete example in the [web example](./examples/web/src/App.tsx).\n\n## Contributing\n\nWant to make the project better? Awesome! Please read through our [Contributing Guidelines](./CONTRIBUTING.md).\n\n## Maintainers\n\nWe all do this for free... so please be nice 😁.\n\n- [@wtrocki](https://github.com/wtrocki)\n- [@wodCZ](https://github.com/wodCZ)\n- [@jspizziri](https://github.com/jspizziri)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapollographql%2Fapollo-cache-persist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapollographql%2Fapollo-cache-persist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapollographql%2Fapollo-cache-persist/lists"}