Caching


This document explains how the Cache Filter & Pagination Results option works in the Divi FilterGrid plugin.

By default, Divi FilterGrid will use AJAX to fetch the results every time a filter or pagination link is clicked. For example, a visitor visits your page that is displaying the Divi FilterGrid module. The user clicks on the number 2 in the pagination to view the page 2 results. Divi FilterGrid will use AJAX to fetch the results for page 2 and replace the page 1 results with the page 2 results.

If the user clicks back to page 1, the exact same chain of events take place. Divi FilterGrid will use AJAX to fetch the results for page 1 and replace the page 2 results with the page 1 results.

The same is true with the filters. If a user clicks on a filter, Divi FilterGrid will use AJAX to fetch only results for the filter clicked. If the user clicks on a filter and then clicks back to the ALL tab, AJAX will be used to fetch the original results from the initial page load.

The Cache Filter & Pagination option aims to optimize this process and minimize AJAX calls. With this option on, the first time a filter or page is clicked, AJAX will be used to fetch the results just like before. The difference is that the results of each click will be temporarily stored in the user’s browser. If the user clicks on the same filter or page again, the results will be loaded from the user’s browser.

It’s important to note the cache is temporarily stored in the user’s browser. If a user refreshes his or her page, the cache will be deleted and AJAX will be used to load the results until the cache is rebuilt in the user’s browser. Also, since the cache is stored in each user’s browser, caching is not shared across users. We are not creating a full query-caching solution. We’re simply minimizing the number of queries per user.

 

Pin It on Pinterest

Share This