WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/11/2013 06:08:14 PM (9 years ago)
Author:
ryan
Message:

Use microtime() instead of incrementors for last_changed to to avoid race conditions with cache evictions.

Props westi
fixes #23448

File:
1 edited

Legend:

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

    r23398 r23401  
    12431243    $last_changed = wp_cache_get( 'last_changed', 'terms' );
    12441244    if ( ! $last_changed ) {
    1245         $last_changed = 1;
     1245        $last_changed = microtime();
    12461246        wp_cache_set( 'last_changed', $last_changed, 'terms' );
    12471247    }
     
    27122712    }
    27132713
    2714     if ( function_exists( 'wp_cache_incr' ) ) {
    2715         wp_cache_incr( 'last_changed', 1, 'terms' );
    2716     } else {
    2717         $last_changed = wp_cache_get( 'last_changed', 'terms' );
    2718         wp_cache_set( 'last_changed', $last_changed + 1, 'terms' );
    2719     }
     2714    wp_cache_set( 'last_changed', microtime(), 'terms' );
    27202715}
    27212716
Note: See TracChangeset for help on using the changeset viewer.