Refine FAQ
Refine App FAQ
What is a cache?
A cache is a collection of stored data, designed to be temporary and very fast to access. Some web pages can take a long time to build: various bits of code and data have to be processed before they can be shown to a user. A cache can store these pages after they have been processed, speeding up the time it takes to view them in the future.
Why is section caching needed? Doesn’t Shopify already cache my site?
It does! Shopify provides full-page caching by default for all stores. However, these caches can expire very often, depending on your configuration. For example, with certain inventory settings, product page caches will be reset on every order (so that out of stock warnings are kept current). If your site receives a high volume of orders, this may cause a large number of customers to see the uncached versions of product pages more often than you intend. Using section caching, we can mitigate this. Shopify themes are broken into multiple sections. With the Refine app, you can cache each section individually, beyond the length of the page cache.
Note: section caches are site-wide.
What sections should I cache?
Because section caches are site-wide, the best candidates are sections that have the same data on every page. Examples may include headers, footers, external data feeds such as Facebook or Instagram, or custom content blocks that are globally scoped.
In addition, sections that perform a lot of processing or that have a large number of content blocks may see the most benefit, as this processing time is what will be saved by having a cache.
Caution: Be careful not to cache a section that may contain user data, unless that data is loaded/manipulated in javascript only. For example, a header section that displays the logged in username will not function if cached.
How often should I set my cache to update?
This depends entirely on your data. Ideally, you want to choose the longest time possible without your customers seeing data that is too out-of-date. Choose a time that makes sense based on how often your content changes.
In addition to the scheduled cache refresh, Refine also allows you to manually refresh a cache whenever required.
HTML vs Javascript caching?
In certain themes, there are sections that only output scripts or JSON data, with no required HTML. These sections can be further optimized by caching them to a .js file, which allows the browser to cache them locally. While most sections will not be able to make use of Javascript caching, those that can will enjoy a speed boost even higher than normal HTML sections.