[wp-trac] [WordPress Trac] #13108: install_popular_tags() should use a transient

WordPress Trac wp-trac at lists.automattic.com
Sun Apr 25 05:31:45 UTC 2010


#13108: install_popular_tags() should use a transient
--------------------------+-------------------------------------------------
 Reporter:  dd32          |       Owner:             
     Type:  defect (bug)  |      Status:  new        
 Priority:  normal        |   Milestone:  3.1        
Component:  Optimization  |     Version:  3.0        
 Severity:  normal        |    Keywords:  needs-patch
--------------------------+-------------------------------------------------
 install_popular_tags() should use a site transient, at present, this is
 the function:

 {{{
 function install_popular_tags( $args = array() ) {
         if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache
 = get_option('wporg_popular_tags')) )
                 add_option('wporg_popular_tags', array(), '', 'no'); ///No
 autoload.

         if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
                 return $cache->cached;

         $tags = plugins_api('hot_tags', $args);

         if ( is_wp_error($tags) )
                 return $tags;

         $cache = (object) array('timeout' => time(), 'cached' => $tags);

         update_option('wporg_popular_tags', $cache);
         wp_cache_set('popular_tags', $cache, 'api');

         return $tags;
 }}}

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


More information about the wp-trac mailing list