24/7 Support: 800.608.6482

How To Guides

How To Guides

Product List Caching & Pre-calculating Predicted Discounts

Miva 9.0007 introduces two caching mechanisms to improve performance across stores. There is nothing you need to do to take advantage of this caching. Once you update to 9.0007 your store will automatically start functioning this way.

Product List Caching

A product list is any page that displays a list of products such as a category page, the search page, or the Product List page (PLST)

Prior to 9.0007 when a category was loaded, Miva would query the database to get all the products assigned to that category, the total count of all products in that category (used in calculating the pagination) and restrict products excluded because they are not active or part of an availability group or filtered out because of a facet value selected. All these queries performed in real time were “expensive” in terms of the time it takes to return the data back to the browser.

To help speed up these type of list view pages, we introduced Product List Caching which saves the results of the query into a separate database so it can be queried faster in subsequent requests to that category.

In testing, we have seen roughly 3x increase in performance in list view pages which are using this new caching

Product List Caching

Cache Expiration

There is now a new setting under Store Settings to control how long Miva will cache the result sets for. The default value is 240 minutes or 4 hours

Settings

Scheduled Tasks

The deletion of the cached results is handled by a scheduled task. There is a new scheduled task called “Delete Cached Product List Entries” which runs every 4 hours as well. When it runs it will look at all expired cached results and delete them. This will force them Miva to reload the full result set from the database on the new page load to that category or product list page.

Scheduled Taks

Entries To Delete - There is a setting on the scheduled task which allows you to delete all cached entries regardless if they are 4 hours old or not.

Next Run

Changing this to “All Cached Product Lists” allows you to then manually run the scheduled task for force all product lists results to be re-cached.

Add New vs Updating Existing Products

When you add new products, Miva automatically invalidates the previous cache for a list view page. Say for example you add a new product to the store and assign it to a category. In this case the cache of that category will automatically get updated. However, if you just update a custom field value on a product which is being used as a facet, that product won’t get included in the result set until the cache expires or you force update the cache (via the scheduled task)

Pre-Calculate Predicted Discounts

A second caching method that was added to list view pages is pre-calculating any predicted discounts. These are any discounts applied to product via price groups.

Say for example you have a price group that puts all products on sale at 10% off. Prior to 9.0007 miva would do this calculation in real-time when the products are loaded.

Now you have the option to pre-calculate any predicted discounts via a scheduled task so that when the page is loaded a static value for the price is being loaded which is much faster.

When calculating the predicted discounts, miva takes into account any customer specific pricing and will correctly calculate all discounts ahead of time.

Scheduled Task

There is a scheduled task that runs once a day to pre-calculate these discounts ahead of time. There is even an option to have Miva calculate discounts for products that will happen in the future so that the price being returned is always up to date.

Edit Scheduled Tasks

Looking for Developer Docs?

We have a whole section for that, including: Developer Training Series, Template Language docs, Module Development tutorials and much, much more.

Head to the Developer Section

This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

Accept

Copyright © 1997 – 2024 Miva®, Miva Merchant®, MivaPay®, MivaCon®, Camp Miva®, Miva Connect®, Miva, Inc. All Rights Reserved.