webpack-bootstrap-ui-kit/src/js/_ajax/_apollo.cache.js

27 lines
634 B
JavaScript
Raw Normal View History

2021-06-19 19:31:41 +02:00
import {
InMemoryCache,
} from '@apollo/client';
//import { IonicStorageModule } from '@ionic/storage';
//import { persistCache, IonicStorageWrapper } from 'apollo3-cache-persist';
2021-06-19 19:31:41 +02:00
import {
persistCacheSync,
LocalStorageWrapper,
} from 'apollo3-cache-persist';
const cache = new InMemoryCache();
// await before instantiating ApolloClient, else queries might run before the cache is persisted
//await persistCache({
persistCacheSync({
cache,
storage: new LocalStorageWrapper(window.localStorage),
key: 'web-persist',
maxSize: 1048576, // 1Mb
//new IonicStorageWrapper(IonicStorageModule),
});
2021-06-19 19:31:41 +02:00
export {
cache,
};