Make WordPress Core


Ignore:
Timestamp:
04/12/2007 02:27:12 AM (18 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.