[wp-trac] [WordPress Trac] #12065: Clean up cache re-init code in Multisite

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 28 10:30:24 UTC 2010


#12065: Clean up cache re-init code in Multisite
--------------------------+-------------------------------------------------
 Reporter:  nacin         |       Owner:     
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.0
Component:  Multisite     |     Version:     
 Severity:  normal        |    Keywords:     
--------------------------+-------------------------------------------------
 During MS load we initialize the object cache again.

 {{{
 wp_cache_init(); // need to init cache again after blog_id is set

 if ( function_exists('wp_cache_add_global_groups') ) { // need to add
 these again. Yes, it's an ugly hack
         wp_cache_add_global_groups(array ('users', 'userlogins',
 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details',
 'rss'));
         wp_cache_add_non_persistent_groups(array( 'comment', 'counts',
 'plugins' ));
 }
 }}}

 Assuming re-initialization indeed needs to occur (a comment says we need
 to after blog_id is set), we can clean this up now that we have
 wp_start_object_cache() in wp-includes/load.php.

 It is also missing the site-transients group, so that will fix this.

 Hypothetically, we could replace that with wp_start_object_cache() and be
 done with it, but to save CPU cycles and an unnecessary filesystem check,
 we should modify wp_start_object_cache() while we're at it.

 We can either split the function into two, or first check if
 wp_cache_init() exists before setting $_wp_using_ext_object_cache,
 checking for the object-cache.php drop-in, and including either wp-content
 /object-cache.php or wp-includes/cache.php.

 Patch attached with one of these options.

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


More information about the wp-trac mailing list