[wp-trac] [WordPress Trac] #37189: In wp_term_query on cache ids

WordPress Trac noreply at wordpress.org
Tue Jun 20 19:14:09 UTC 2017


#37189: In wp_term_query on cache ids
--------------------------+--------------------------
 Reporter:  spacedmonkey  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  4.9
Component:  Taxonomy      |     Version:  4.6
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+--------------------------

Comment (by spacedmonkey):

 My feedback so.

 - How the key is generated is how over query classes with cache (such as
 site query) generate the key. Because of the nature of the code in
 wp_term_query, the request (sql query) is in place. I don't see a problem
 with using it is a cache key. It just makes it an outlier.
 - The patch remove the cache expiry time of DAY_IN_SECONDS on the term
 cache. I have never understood why this was put in, as if cache
 invalidation is correct, then it should never be needed. Caching for just
 one day might end up in surges on the databases when all caches invalidate
 at once on high traffic sites.
 - Querying by id then a second query to populate the terms, is how over
 query classes work. It results in more queries, but each query is simpler,
 returning faster from the db.
 - Completely forgot to mention the bug in WP_Term, my bad. Seems unrelated
 to the changes and was there before.
 - I like breaking out the cache invalidation term into two. Current the
 clean_term_cache action is broken. The current action looks like this
 ```do_action( 'clean_term_cache', $ids, $taxonomy, $clean_taxonomy );```
 in the patch it looks like this ```do_action( 'clean_term_cache',
 $taxonomy ); ```. The current action should be maintained and a new
 `clean_taxonomy_cache` added.
 - Any tests that query count should be removed. Whenever caching is added
 in core, lots of random tests start to fail.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37189#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list