[wp-trac] [WordPress Trac] #52710: Taxonomy: Make it possible to bypass automatic caching of results in `get_terms()`

WordPress Trac noreply at wordpress.org
Sun Jan 23 23:22:00 UTC 2022

#52710: Taxonomy: Make it possible to bypass automatic caching of results in
 Reporter:  dlh                         |       Owner:  (none)
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Taxonomy                    |     Version:  2.3
 Severity:  normal                      |  Resolution:
 Keywords:  needs-unit-tests has-patch  |     Focuses:  performance

Comment (by dlh):

 Hey @peterwilsoncc — yes, I think that one-liner would have the same
 effect, but with a couple other effects that might not be as desirable:

 - Term objects would no longer be persistently cached,
 includes/class-wp-term.php#L179 since those also go into the 'terms'
 group]. In the scenario I was describing, individual terms themselves
 don't change all that often, but they're still accessed all the time, so
 having them in the object cache might still be beneficial.

 - More speculatively, sites would would be cut off from any future caching
 enhancements that core puts into place under `terms`.

 Still, for sites like the one I was describing, perhaps those are the
 tradeoffs they have to make? Or let me know if I've misunderstood

 @spacedmonkey - if I'm following correctly, I don't think setting
 `cache_domain` to a random string would have the expected effect. As you
 say, the resulting `wp_cache_get()` would always miss; after that, the
 data then stored with `wp_cache_set()` would never be hit. Both of those
 calls would represent unnecessary traffic to the caching backend, and the
 cached data would be dead on arrival, just waiting to be evicted or to
 expire without any chance of being used.

Ticket URL: <https://core.trac.wordpress.org/ticket/52710#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list