How Can We Help?
< Back
You are here:

Transients! What, why, and how to cache bust our reports!

Here at The Rite Sites, we are trying to bring you as close to a WooCommerce Core experience as possible, all while improving your dashboard tools. One thing, that is debated among developers, that we follow WooCommerce in doing is storing report data in Transients. These act as a cache and allow for efficient re-displaying of the data in a reported time frame.

While making looking at old data more efficient, this can seem to be a problem if you are looking at data being collected today, throughout the day. If you look at your Net Profit graph or table just after the clock passes midnight for your store, without clearing the cache, you will continue to see that most likely $0 value for all your data today, even as you see orders coming in! In order to fix this, you just press the Red Button at the top of the report to clear all of the transients related to our reports.

The transients are not focused on a single days numbers, but rather the reported date ranges results. If you run a report for January 4th through January 11th, and you then create an order for January 11th marked completed, you will not see that order if you refresh that report. If you run a report from January 4th through January 12th, you will see that new order in the January 11th data. As noted before, the transient data does not effect each individual day, but rather the report as a whole.

Deep Dive into Transients!

Transients are temporary data stored in the database. These come with an expiration time and as of WordPress version 3.7, are automatically deleted when a Database Upgrade occurs. Transients are created by having a unique key created by, in this case, the date range selected, and the report name. This key is associated to the report values generated and calculated and is stored in the database until it expires or is deleted.
There is a lot of debate about when it is appropriate to use transients. Many developers have come down against WooCommerce saying transients should not be used for data reports, as the data should be as accurate and up to date as possible. We agree with them. In hopes to stay close to Core, we kept the transient creation in. There is no question that having these transients does help reduce server time needed while in the admin dashboard. This is less of an issue on high end servers, but as the goal of the WordPress and WooCommerce projects is to make websites and storefronts accessible to the world, we need to account for slow internet and server speeds.
Table of Contents