Thanks for the question.
Persistent object cache items appear in groups, with each group having its own name. The names are stringslike 'options' or 'category_relationships'.
You can use wp_cache_add_non_persistent_groups() to tell the object cache not to store the cached items for the groups of your choice. If you call it from an 'init' action handler it should work.
But I don’t know what cache group you’d mention to change the behavior of Woo related products. If you explain what you’re trying to do in a bit more detail, maybe I can be more helpful.
The object cache doesn’t work like the page cache, where you can suppress caching certain pages and always regenerate them.
I’m using the regular related products that are included in the woocommerce and I’ve noticed the list is rather limited. Almost the same products are being generated with each refresh. The function is set to grab a random list, but query monitor isn’t showing me any query with the word “rand” in it so the only reason that comes to my mind is that the cache is keeping it for an unspecified amount of time.
I’ve managed to find that the function is using get_transient to keep the data. I’ve downloaded .ht.object-cache.-a.sqlite and after a longer fight with sqlitestudio I’ve finally got the list of records with the names like transient|wc_related_10242. The value of this record seems correct (at least for 3 randomly picked products from the related section of the page). And this is where I’ve got stuck, because I have no idea where and what I should look for. The value for the expiration seems to be set to +1 day and I would love to change it to 3 hours if that’s possible.
Aha, thanks for digging up the name of the transient. Your problem showed up as a feature request to this plugin because the persistent object cache, when in use, is WordPress’s means of storing transients. When no object cache is available, those transients go into the wp_options table. So, the solution to your problem needs to work with the transients subsystem, not the object cache subsystem.
Here is a writeup on how to change the time-to-live, the expiration, of the related-products transients.
To test this sort of thing, you can flush the object cache. That has the effect of deleting all transients. It may, of course, hammer the performance of your live site.