Installations
npm install apollo-cache-persist-dev
Developer
apollographql
Developer Guide
Module System
CommonJS, UMD
Min. Node Version
Typescript Support
No
Node Version
10.15.3
NPM Version
6.4.1
Statistics
1,394 Stars
459 Commits
118 Forks
40 Watching
14 Branches
56 Contributors
Updated on 11 Nov 2024
Languages
TypeScript (98.7%)
JavaScript (1.3%)
Total Downloads
Cumulative downloads
Total Downloads
220,337
Last day
30.3%
43
Compared to previous day
Last week
-2.4%
163
Compared to previous week
Last month
-32.7%
697
Compared to previous month
Last year
-32.8%
12,818
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
apollo3-cache-persist
Simple persistence for all Apollo Client 3.0 cache implementations, including
InMemoryCache
and Hermes
.
Supports web and React Native. See all storage providers.
Basic Usage
1npm install --save apollo3-cache-persist
or
1yarn add apollo3-cache-persist
To get started, simply pass your Apollo cache and an
underlying storage provider to persistCache
.
By default, the contents of your Apollo cache will be immediately restored (asynchronously, see how to persist data before rendering), and will be persisted upon every write to the cache (with a short debounce interval).
Examples
React Native
1import AsyncStorage from '@react-native-async-storage/async-storage'; 2import { InMemoryCache } from '@apollo/client/core'; 3import { persistCache, AsyncStorageWrapper } from 'apollo3-cache-persist'; 4 5const cache = new InMemoryCache({...}); 6 7// await before instantiating ApolloClient, else queries might run before the cache is persisted 8await persistCache({ 9 cache, 10 storage: new AsyncStorageWrapper(AsyncStorage), 11}); 12 13// Continue setting up Apollo as usual. 14 15const client = new ApolloClient({ 16 cache, 17 ... 18});
Web
1import { InMemoryCache } from '@apollo/client/core'; 2import { persistCache, LocalStorageWrapper } from 'apollo3-cache-persist'; 3 4const cache = new InMemoryCache({...}); 5 6// await before instantiating ApolloClient, else queries might run before the cache is persisted 7await persistCache({ 8 cache, 9 storage: new LocalStorageWrapper(window.localStorage), 10}); 11 12// Continue setting up Apollo as usual. 13 14const client = new ApolloClient({ 15 cache, 16 ... 17});
See a complete example in the web example.
Contributing
Want to make the project better? Awesome! Please read through our Contributing Guidelines.
Maintainers
We all do this for free... so please be nice 😁.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/apollographql/.github/SECURITY.md:1
- Info: Found linked content: github.com/apollographql/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/apollographql/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/apollographql/.github/SECURITY.md:1
Reason
Found 5/14 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 21 are checked with a SAST tool
Reason
16 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-mpg4-rc92-vx8v
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
3.5
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More