WordPress.org

Make WordPress Core

Changeset 23384


Ignore:
Timestamp:
02/04/13 13:48:46 (15 months ago)
Author:
ryan
Message:

Use incrementors for cache invalidation in get_terms().

fixes #23326
see #23173

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r22878 r23384  
    12411241    $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : ''; 
    12421242    $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); 
    1243     $last_changed = wp_cache_get('last_changed', 'terms'); 
    1244     if ( !$last_changed ) { 
    1245         $last_changed = time(); 
    1246         wp_cache_set('last_changed', $last_changed, 'terms'); 
     1243    $last_changed = wp_cache_get( 'last_changed', 'terms' ); 
     1244    if ( ! $last_changed ) { 
     1245        $last_changed = 1; 
     1246        wp_cache_set( 'last_changed', $last_changed, 'terms' ); 
    12471247    } 
    12481248    $cache_key = "get_terms:$key:$last_changed"; 
     
    26332633    } 
    26342634 
    2635     wp_cache_set('last_changed', time(), 'terms'); 
     2635    if ( function_exists( 'wp_cache_incr' ) ) { 
     2636        wp_cache_incr( 'last_changed', 1, 'terms' ); 
     2637    } else { 
     2638        $last_changed = wp_cache_get( 'last_changed', 'terms' ); 
     2639        wp_cache_set( 'last_changed', $last_changed + 1, 'terms' ); 
     2640    } 
    26362641} 
    26372642 
Note: See TracChangeset for help on using the changeset viewer.