forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Query: Increase
WP_Query
cache hits for equivalent arguments.
Introduces normalization a number of arguments passed to `WP_Query` to increase cache hits for equivalent requests. For example `author__in => [ 1, 2 ]` and `author__in => [ 2, 1 ]` will now hit the same cache. Prior to generating the SQL request and cache key, the following are sorted, made unique and type cast as appropriate. * `post_type` when passed as an array * `post_status` when passed as an array * `term_query`s containing `terms` * `cat` * `category__in` * `category__not_in` * `category__and` * `tag_slug__in` * `tag__in` * `tag__not_in` * `tag__and` * `tag_slug__in` * `tag_slug__and` * `post_parent__not_in` * `author` * `author__not_in` * `author__in` The following are sorted for the purposes of generating the cache key and SQL `WHERE` clause but unmodified for use in the `ORDER BY` SQL clause: * `post_name__in` * `post__in` * `post_parent__in` This commit includes changes to unrelated tests, assertions in `Tests_Query_ParseQuery::test_parse_query_cat_array_mixed()` and `WP_Test_REST_Posts_Controller::test_get_items_not_sticky_with_exclude()` have been modified to account for the sorting of the items above. Props thekt12, peterwilsoncc, spacedmonkey, joemcgill, flixos90, mukesh27, pbearne, swissspidy. Fixes #59516. git-svn-id: https://develop.svn.wordpress.org/trunk@59766 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information
1 parent
a11571e
commit c22e267
Showing
4 changed files
with
495 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.