Introduction to Precaching: One of the most important features of PWAs is the ability to load fast and to work on slow network conditions or even offline. To achieve this, we can use a service worker to precache the app and, when available, use the network only to fetch necessary data.
In our PWA for WP & AMP plugin, we’ve implemented the Pre-caching functionality which helps you to cache the content.
There are two ways you can cache the content
1) Automatic
- You will find this option in the WordPress Dashboard -> PWA -> Settings -> Features -> Enable “Pre Caching” option -> Click on the “gear” icon like as below the screenshot.
- Once you click on gear icon you can access the Settings page. By enabling Automatic option you can cache the Post, Page and Custom Post Type and also you can set the number of posts which you want to cache.
2) Manual
- You will find this option in the WordPress Dashboard -> PWA -> Settings -> Features -> Enable “Pre Caching” option -> Click on the “gear” icon.Once you click on gear icon you can access the Settings page. By enabling Manual option, you can directly add the URLs which you want to get the cache.
Note: You can cache as many posts as you want but it will be better if you use 10 posts for better performance.
That’s it for this tutorial!
We hope we’ve clear your doubts in case If you have any feedback or questions, Just contact us here and we are always available for you.