The WordPress persistent object cache subsystem doesn’t work that way. Stuff would break if it were disabled on certain pages or at certain times. For one thing, when the persistent object cache is enabled, WordPress puts transients in it rather than in the wp_options table.
If you reply to this thread explaining why you want to do this, I might be able to offer better advice.
@olliejones After some investigation, the best option seems to use the wp_cache_add_non_persistent_groups call. With one exception though, how can I exclude the default group (just for debugging purposes) because many of the wp_cache_set calls don’t specify a particular group, they are stored in the default group(the unamed one), can I use
wp_cache_add_non_persistent_groups([”]);
https://github.com/OllieJones/sqlite-object-cache/blob/1e192c4872ed90e5f2d9e9aa0bde71319edfaaa9/assets/drop-in/object-cache.php#L1441C1-L1446C1
Yes, that should work. I haven’t tested it. It has to be said, disabling the default group disables a lot of performance-enhancing stuff.
I really really want to understand what’s going on in your situation. It’s possible the API or my code has some sort of shortcoming or defect, and it would be good to fix it if so. Thanks.
@olliejones Hi, thanks. I understand it’s a bit unusal for me to throw such questions. My situation is like this, I eanbled object cache, then I found two things broken:
- many cron events start to overdue and manually issue wp cron event run –all didn’t fix that, only temporarily disabling object cache managed to bring the cron stats to normal – no overdue
- Elementor automatically regenrates css files under wp-content/uploads/elementor/css/, I found that if I keep object cache active, after a while, the css files could fail to regenrate which led to a broken site
So I figure if I could exclude all cache groups including the default group then gradually remove them out of the non-persistent groups I could pin-pint the exact causes to the above issues.
Thanks for this information. If you need more help please start another topic.