Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 3.08 KB

storage-providers.md

File metadata and controls

49 lines (37 loc) · 3.08 KB

Storage Providers

Natively Supported Providers

apollo3-cache-persist provides wrappers for the following storage providers, with no additional dependencies:

Storage provider Platform Wrapper class
AsyncStorage* React Native AsyncStorageWrapper
window.localStorage web LocalStorageWrapper
window.sessionStorage web SessionStorageWrapper
localForage web LocalForageWrapper
Ionic storage web and mobile IonicStorageWrapper
MMKV Storage React Native MMKVStorageWrapper
MMKV React Native MMKVWrapper

Redux Persist Providers

apollo3-cache-persist uses the same storage provider API as redux-persist, so you can also make use of the providers listed here, including:

AsyncStorage Caveat

*AsyncStorage does not support individual values in excess of 2 MB on Android. If you set maxSize to more than 2 MB or to false, use a different storage provider, such as react-native-mmkv-storage or redux-persist-fs-storage.

Using other storage providers

apollo3-cache-persist supports stable versions of storage providers mentioned above. If you want to use other storage provider, or there's a breaking change in next version of supported provider, you can create your own wrapper. For an example of a simple wrapper have a look at AsyncStorageWrapper.

If you found that stable version of supported provider is no-longer compatible, please submit an issue or a Pull Request.