[wp-trac] [WordPress Trac] #7237: Multiple clean_post_cache() calls when saving a post due to post revisions

WordPress Trac noreply at wordpress.org
Thu Feb 21 19:07:11 UTC 2013


#7237: Multiple clean_post_cache() calls when saving a post due to post revisions
-------------------------------+----------------------
 Reporter:  mdawaffe           |       Owner:  ryan
     Type:  enhancement        |      Status:  closed
 Priority:  lowest             |   Milestone:
Component:  Revisions          |     Version:  2.6
 Severity:  minor              |  Resolution:  wontfix
 Keywords:  reporter-feedback  |
-------------------------------+----------------------
Changes (by nacin):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  3.6 =>


Comment:

 Here's what a typical execution looks like, for saving an existing post:

  * wp_insert_post() triggers get_post(), fetching from the DB the current
 row of the post
  * The revision gets created, triggering clean_post_cache(), which (since
 only a post ID is passed) fetches the row from the DB
  * As the cache is cleared, the ensuing get_post() then fetches the
 revision's row from the DB again
  * The main post's cache is cleared, then the post is again pulled from
 the DB

 The only thing that could be avoided is avoiding some clean_post_cache()
 work when we are inserting a new post. Not even all of it, because we'll
 probably still want to make sure that the hook fires and certain things
 get cleared, like wp_get_archives, get_pages, etc (these are all being
 moved to incrementors, but still).

 But is it really a bad thing to force things like `wp_cache_delete(
 $post->ID, 'posts' );`? Just to make sure there is absolutely no cache
 pollution.

 So I think this is wontfix. In 3.5,  removed the double clean_post_cache()
 calls (it used to happen twice in wp_insert_post(), one of them on the
 save_post hook) and prevented children caching clearing, which alleviated
 the vast majority of this.

 Also, revisions are getting more powerful. They're eventually going to
 have metadata, and a lot of plugins (like Edit Flow and Post Forking) have
 an interest in strengthening revisions. Given there is barely any
 performance impact, I'm closing this.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/7237#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list