Actually make use of wp_cache_add to avoid unnecessary cache writes. Props skeltoac. fixes #4138

git-svn-id: https://develop.svn.wordpress.org/trunk@5248 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-04-12 02:27:12 +00:00
parent e8c058cfc1
commit d8c8ecb711
5 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -1012,7 +1012,7 @@ function get_all_page_ids() {
if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) {
$page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'");
wp_cache_set('all_page_ids', $page_ids, 'pages');
wp_cache_add('all_page_ids', $page_ids, 'pages');
}
return $page_ids;
@@ -1055,7 +1055,7 @@ function &get_page(&$page, $output = OBJECT) {
return get_post($_page, $output);
// Potential issue: we're not checking to see if the post_type = 'page'
// So all non-'post' posts will get cached as pages.
wp_cache_set($_page->ID, $_page, 'pages');
wp_cache_add($_page->ID, $_page, 'pages');
}
}
}