Changeset 5248

Show
Ignore:
Timestamp:
04/12/07 02:27:12 (1 year ago)
Author:
ryan
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/bookmark.php

    r5119 r5248  
    137137 
    138138    $cache[ $key ] = $results; 
    139     wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); 
     139    wp_cache_add( 'get_bookmarks', $cache, 'bookmark' ); 
    140140 
    141141    return apply_filters('get_bookmarks', $results, $r); 
  • trunk/wp-includes/category.php

    r5234 r5248  
    99    if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) { 
    1010        $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'); 
    1212    } 
    1313 
     
    140140 
    141141    $cache[ $key ] = $categories; 
    142     wp_cache_set( 'get_categories', $cache, 'category' ); 
     142    wp_cache_add( 'get_categories', $cache, 'category' ); 
    143143 
    144144    $categories = apply_filters('get_categories', $categories, $r); 
     
    161161        if ( ! $_category = wp_cache_get($category, 'category') ) { 
    162162            $_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'); 
    164164        } 
    165165    } 
  • trunk/wp-includes/functions.php

    r5240 r5248  
    230230            if( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values 
    231231                $value = $row->option_value; 
    232                 wp_cache_set($setting, $value, 'options'); 
     232                wp_cache_add($setting, $value, 'options'); 
    233233            } else { // option does not exist, so we must cache its non-existence 
    234234                $notoptions[$setting] = true; 
     
    295295        foreach ( (array) $alloptions_db as $o ) 
    296296            $alloptions[$o->option_name] = $o->option_value; 
    297         wp_cache_set('alloptions', $alloptions, 'options'); 
     297        wp_cache_add('alloptions', $alloptions, 'options'); 
    298298    } 
    299299    return $alloptions; 
  • trunk/wp-includes/general-template.php

    r5144 r5248  
    636636    echo $output; 
    637637    $cache[ $key ] = $output; 
    638     wp_cache_set( 'get_calendar', $cache, 'calendar' ); 
     638    wp_cache_add( 'get_calendar', $cache, 'calendar' ); 
    639639} 
    640640 
  • trunk/wp-includes/post.php

    r5244 r5248  
    10131013    if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) { 
    10141014        $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'); 
    10161016    } 
    10171017 
     
    10561056                // Potential issue: we're not checking to see if the post_type = 'page' 
    10571057                // 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'); 
    10591059            } 
    10601060        }