[wp-trac] [WordPress Trac] #37762: cache_results parameter doesn't prevent queried posts from being added to cache

WordPress Trac noreply at wordpress.org
Tue Aug 30 12:21:07 UTC 2016


#37762: cache_results parameter doesn't prevent queried posts from being added to
cache
--------------------------+------------------------------
 Reporter:  Dang Vu       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  4.6
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  performance
--------------------------+------------------------------

Comment (by Dang Vu):

 Replying to [comment:3 achbed]:
 > What's interesting is that the individual posts are loaded and cached to
 the object cache individually, but the combined query result is what is
 controlled via the `cache_results` parameter. This seems to meet the
 defined parameter intent because it's not caching the full result of the
 query.  If the posts themselves change enough that you can't use object
 caching I'd be truly surprised.
 >
 > If you want to prevent the posts themselves from caching, that appears
 to be a different request and intent.  Maybe an additional `cache_posts`
 parameter to control that piece of the caching puzzle?
 >
 > We should update the docs at the very least to explain this behavior.

 You're right! The usage of the `cache_results` parameter is unclear. A
 ticket for `cache_posts` parameter looks promising.
 Honestly, I don't understand why WordPress needs to add queried posts to
 both the `WP_Query::posts` and the cache since they only exist in a single
 page load.

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


More information about the wp-trac mailing list