Recent entries widget caching fixes from mdawaffe.

git-svn-id: http://svn.automattic.com/wordpress/trunk@6687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-01-29 23:28:58 +00:00
parent 93e7ffb118
commit dd7370dbe9
1 changed files with 4 additions and 3 deletions

View File

@ -848,7 +848,7 @@ function wp_widget_categories_upgrade() {
} }
function wp_widget_recent_entries($args) { function wp_widget_recent_entries($args) {
if ( $output = wp_cache_get('widget_recent_entries') ) if ( $output = wp_cache_get('widget_recent_entries', 'widget') )
return print($output); return print($output);
ob_start(); ob_start();
@ -876,15 +876,16 @@ function wp_widget_recent_entries($args) {
<?php <?php
wp_reset_query(); // Restore global post data stomped by the_post(). wp_reset_query(); // Restore global post data stomped by the_post().
endif; endif;
wp_cache_add('widget_recent_entries', ob_get_flush()); wp_cache_add('widget_recent_entries', ob_get_flush(), 'widget');
} }
function wp_flush_widget_recent_entries() { function wp_flush_widget_recent_entries() {
wp_cache_delete('widget_recent_entries'); wp_cache_delete('widget_recent_entries', 'widget');
} }
add_action('save_post', 'wp_flush_widget_recent_entries'); add_action('save_post', 'wp_flush_widget_recent_entries');
add_action('deleted_post', 'wp_flush_widget_recent_entries'); add_action('deleted_post', 'wp_flush_widget_recent_entries');
add_action('switch_theme', 'wp_flush_widget_recent_entries');
function wp_widget_recent_entries_control() { function wp_widget_recent_entries_control() {
$options = $newoptions = get_option('widget_recent_entries'); $options = $newoptions = get_option('widget_recent_entries');