Use cache sets instead of adds. Props andy. fixes #3562
git-svn-id: http://svn.automattic.com/wordpress/trunk@4722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
efea3d66fc
commit
9b0816118a
|
@ -5,7 +5,7 @@ function get_all_category_ids() {
|
||||||
|
|
||||||
if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
|
if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
|
||||||
$cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
|
$cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
|
||||||
wp_cache_add('all_category_ids', $cat_ids, 'category');
|
wp_cache_set('all_category_ids', $cat_ids, 'category');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $cat_ids;
|
return $cat_ids;
|
||||||
|
@ -148,7 +148,7 @@ function &get_category(&$category, $output = OBJECT) {
|
||||||
} else {
|
} else {
|
||||||
if ( ! $_category = wp_cache_get($category, 'category') ) {
|
if ( ! $_category = wp_cache_get($category, 'category') ) {
|
||||||
$_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1");
|
$_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1");
|
||||||
wp_cache_add($category, $_category, 'category');
|
wp_cache_set($category, $_category, 'category');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -902,7 +902,7 @@ function get_all_page_ids() {
|
||||||
|
|
||||||
if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) {
|
if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) {
|
||||||
$page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'");
|
$page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'");
|
||||||
wp_cache_add('all_page_ids', $page_ids, 'pages');
|
wp_cache_set('all_page_ids', $page_ids, 'pages');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $page_ids;
|
return $page_ids;
|
||||||
|
@ -944,7 +944,7 @@ function &get_page(&$page, $output = OBJECT) {
|
||||||
return get_post($_page, $output);
|
return get_post($_page, $output);
|
||||||
// Potential issue: we're not checking to see if the post_type = 'page'
|
// Potential issue: we're not checking to see if the post_type = 'page'
|
||||||
// So all non-'post' posts will get cached as pages.
|
// So all non-'post' posts will get cached as pages.
|
||||||
wp_cache_add($_page->ID, $_page, 'pages');
|
wp_cache_set($_page->ID, $_page, 'pages');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue