I subscribed to the GH issue. The only thing I frequently see is that when people disable the object cache without also flushing it right after or right before re-activating it, then the old stale cache data will show up on the site, and sometimes is even written back to SQL.
I found the problem.
WooCommerce creates transients with names like product-transient-revision and uses their values (timestamps) to cons up the names of other transients. Deactivating a persistent object cache plugin makes those transients’ values revert to whatever they were before the object cache was activated. That is, they revert to stale values. In turn that means that other stale transients get used to look up variants and other product stuff.
This way of using transients made it into WooCommerce as a fix to their performance defect [#5777](https://github.com/woocommerce/woocommerce/issues/5777) .
The fix to object caching plugins is to delete all transients from the database upon deactivation, so no stale values are left.
I added this to Redis Object Cache. Object Cache Pro was already doing it.
Hi,
I experienced this in the past. Which made me stop using the plugin. Happy that the source of the issue is found.
I was looking at the commit that addressed it: https://github.com/rhubarbgroup/redis-cache/commit/6e2f8e6377cbe4db70a744cb5de07b9c15c89644 . But i see that the clearing of transients has been added when the object cache is enabled. But wasn’t the problem that it should be added when it is disabled?
Sorry If I am clearly overlooking something.
You are correct that the precise defect is fixed by clearing the vestigial transients from MariaDB / MySQL upon disabling the plugin. Still, they become vestigial the moment the plugin is activated. So, I made the judgement call to clear them on enabling as well. My purpose in doing that is avoiding confusion for a tiny handful of plugin devvelopers who write their own SQL code to get transients.
It is redundant for compliant use of the transients API, as you say.
@boosterbast feel free to open a PR of another fix is needed. We’ve not heard of any issues since that was released.
I clear those stale DBMS-resident transients, in the SQLite Object cache plugin, both on deactivation and activation. Strictly speaking, clearing them only on deactivation is required. But they become stale the instant the object cache plugin is activated. I had a confused developer-user who was using their own SQL to grab transients rather than going through the transient API (didn’t know the object cache serves them if it’s active). So I, arbitrarily, decided to get rid of them on activation too. To increase their confusion to the breaking point so they’d have to figure it out.
(People sometimes do weird things in the WordPress world.)
-
This reply was modified 2 months, 4 weeks ago by
OllieJones.