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

View File

@@ -229,7 +229,7 @@ function get_option($setting) {
if( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
$value = $row->option_value;
wp_cache_set($setting, $value, 'options');
wp_cache_add($setting, $value, 'options');
} else { // option does not exist, so we must cache its non-existence
$notoptions[$setting] = true;
wp_cache_set('notoptions', $notoptions, 'options');
@@ -294,7 +294,7 @@ function wp_load_alloptions() {
$alloptions = array();
foreach ( (array) $alloptions_db as $o )
$alloptions[$o->option_name] = $o->option_value;
wp_cache_set('alloptions', $alloptions, 'options');
wp_cache_add('alloptions', $alloptions, 'options');
}
return $alloptions;
}