Gathering detailed insights and metrics for apollo-cache-persist-dev
Gathering detailed insights and metrics for apollo-cache-persist-dev
Gathering detailed insights and metrics for apollo-cache-persist-dev
Gathering detailed insights and metrics for apollo-cache-persist-dev
npm install apollo-cache-persist-dev
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,394 Stars
459 Commits
118 Forks
40 Watching
14 Branches
56 Contributors
Updated on 11 Nov 2024
TypeScript (98.7%)
JavaScript (1.3%)
Cumulative downloads
Total Downloads
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
Simple persistence for all Apollo Client 3.0 cache implementations, including
InMemoryCache
and Hermes
.
Supports web and React Native. See all storage providers.
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).
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});
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.
Want to make the project better? Awesome! Please read through our Contributing Guidelines.
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
Reason
security policy file detected
Details
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
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
16 existing vulnerabilities detected
Details
Score
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