Company
Date Published
Author
James Reggio
Word count
778
Language
English
Hacker News points
None

Summary

Apollo Client 2.0 introduces a new library called `apollo-cache-persist` to seamlessly save and restore the Apollo cache from persistent storage, allowing for better offline experiences and reduced latency in mobile apps. The library is compatible with various storage providers, including AsyncStorage and localForage, and works with Apollo Client 2.0's default InMemoryCache and Hermes alternatives. It also supports automatic persistence, which can be configured to run in the background or on a non-deterministic schedule, reducing the impact of cache updates on app performance. The library provides methods for explicitly extracting, restoring, purging, and measuring the cache, as well as pause and resume options for manual control. Additionally, it is compatible with Redux persist storage providers, offering fine-grained cache controls through directives and metadata in future releases.