Make WordPress Core


Ignore:
Timestamp:
02/11/2013 06:08:14 PM (14 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/post.php

    r23387 r23401  
    36543654        $last_changed = wp_cache_get( 'last_changed', 'posts' );
    36553655        if ( ! $last_changed ) {
    3656                 $last_changed = 1;
     3656                $last_changed = microtime();
    36573657                wp_cache_set( 'last_changed', $last_changed, 'posts' );
    36583658        }
     
    46734673        }
    46744674
    4675         if ( function_exists( 'wp_cache_incr' ) ) {
    4676                 wp_cache_incr( 'last_changed', 1, 'posts' );
    4677         } else {
    4678                 $last_changed = wp_cache_get( 'last_changed', 'posts' );
    4679                 wp_cache_set( 'last_changed', $last_changed + 1, 'posts' );
    4680         }
     4675        wp_cache_set( 'last_changed', microtime(), 'posts' );
    46814676}
    46824677
Note: See TracChangeset for help on using the changeset viewer.