[wp-trac] [WordPress Trac] #15543: _get_last_post_time() uses the incorrect cache key

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 22 20:25:27 UTC 2010


#15543: _get_last_post_time() uses the incorrect cache key
--------------------------+-------------------------------------------------
 Reporter:  mdawaffe      |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:                 
 Severity:  normal        |    Keywords:                 
--------------------------+-------------------------------------------------
 [15838] sets the cache key to
  {{{"lastpost{$field}:" . get_current_blog_id() . ":$timezone:" . md5(
 serialize( $post_types ) )}}}

 but that key is never invalidated.  The invalidation is meant to be
 handled by {{{_transition_post_status()}}}.

 There's no need to explicitly include the blog_id in a cache key.

 If the data needs to be cached by some dynamic variable ($post_types, in
 this case), there are a few options.

  1. The invalidation needs to be a lot smarter (hard).
  2. The cached data needs to be an array ({{{$data[ serialize( ... ) ] =
 $date}}}) so that it can be invalidated all at once (bad - leads to race
 conditions).
  3. The data should only be cached for one single page load
 ({{{wp_cache_add_non_persistent_groups()}}}).
  4.  Something else?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15543>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list