Ticket #4138: cache_add.diff
| File cache_add.diff, 3.6 KB (added by , 19 years ago) |
|---|
-
wp-includes/bookmark.php
136 136 $results = $wpdb->get_results($query); 137 137 138 138 $cache[ $key ] = $results; 139 wp_cache_ set( 'get_bookmarks', $cache, 'bookmark' );139 wp_cache_add( 'get_bookmarks', $cache, 'bookmark' ); 140 140 141 141 return apply_filters('get_bookmarks', $results, $r); 142 142 } -
wp-includes/category.php
8 8 9 9 if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) { 10 10 $cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); 11 wp_cache_ set('all_category_ids', $cat_ids, 'category');11 wp_cache_add('all_category_ids', $cat_ids, 'category'); 12 12 } 13 13 14 14 return $cat_ids; … … 139 139 reset ( $categories ); 140 140 141 141 $cache[ $key ] = $categories; 142 wp_cache_ set( 'get_categories', $cache, 'category' );142 wp_cache_add( 'get_categories', $cache, 'category' ); 143 143 144 144 $categories = apply_filters('get_categories', $categories, $r); 145 145 return $categories; … … 160 160 $category = (int) $category; 161 161 if ( ! $_category = wp_cache_get($category, 'category') ) { 162 162 $_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1"); 163 wp_cache_ set($category, $_category, 'category');163 wp_cache_add($category, $_category, 'category'); 164 164 } 165 165 } 166 166 -
wp-includes/post.php
1012 1012 1013 1013 if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) { 1014 1014 $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'"); 1015 wp_cache_ set('all_page_ids', $page_ids, 'pages');1015 wp_cache_add('all_page_ids', $page_ids, 'pages'); 1016 1016 } 1017 1017 1018 1018 return $page_ids; … … 1055 1055 return get_post($_page, $output); 1056 1056 // Potential issue: we're not checking to see if the post_type = 'page' 1057 1057 // So all non-'post' posts will get cached as pages. 1058 wp_cache_ set($_page->ID, $_page, 'pages');1058 wp_cache_add($_page->ID, $_page, 'pages'); 1059 1059 } 1060 1060 } 1061 1061 } -
wp-includes/general-template.php
635 635 ob_end_clean(); 636 636 echo $output; 637 637 $cache[ $key ] = $output; 638 wp_cache_ set( 'get_calendar', $cache, 'calendar' );638 wp_cache_add( 'get_calendar', $cache, 'calendar' ); 639 639 } 640 640 641 641 function delete_get_calendar_cache() { -
wp-includes/functions.php
229 229 230 230 if( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values 231 231 $value = $row->option_value; 232 wp_cache_ set($setting, $value, 'options');232 wp_cache_add($setting, $value, 'options'); 233 233 } else { // option does not exist, so we must cache its non-existence 234 234 $notoptions[$setting] = true; 235 235 wp_cache_set('notoptions', $notoptions, 'options'); … … 294 294 $alloptions = array(); 295 295 foreach ( (array) $alloptions_db as $o ) 296 296 $alloptions[$o->option_name] = $o->option_value; 297 wp_cache_ set('alloptions', $alloptions, 'options');297 wp_cache_add('alloptions', $alloptions, 'options'); 298 298 } 299 299 return $alloptions; 300 300 }