Changeset 30073
- Timestamp:
- 10/28/2014 09:04:52 PM (10 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r30058 r30073 4743 4743 return (bool) $var; 4744 4744 } 4745 4746 /**4747 * Helper function to retrieve an incrementer identified by $group4748 *4749 * @since 4.1.04750 *4751 * @param string $group The cache group for the incrementer.4752 * @param bool $force Whether or not to generate a new incrementor.4753 * @return int The timestamp representing 'last_changed'.4754 */4755 function wp_get_last_changed( $group, $force = false ) {4756 $last_changed = wp_cache_get( 'last_changed', $group );4757 if ( ! $last_changed || true === $force ) {4758 $last_changed = microtime();4759 wp_cache_set( 'last_changed', $last_changed, $group );4760 }4761 return $last_changed;4762 } -
trunk/src/wp-includes/taxonomy.php
r30052 r30073 1292 1292 } 1293 1293 1294 $ group = $taxonomy . ':' . wp_get_last_changed('terms' );1294 $incrementor = wp_cache_get( 'last_changed', 'terms' ); 1295 1295 if ( is_object($term) && empty($term->filter) ) { 1296 wp_cache_add( $term->term_id, $term, $taxonomy );1297 wp_cache_add( "slug:{$term->slug}", $term->term_id, $group);1298 wp_cache_add( "name:" . md5( $term->name ), $term->term_id, $group);1296 wp_cache_add( $term->term_id, $term, $taxonomy . ':terms:' . $incrementor ); 1297 wp_cache_add( $term->slug, $term->term_id, $taxonomy . ':slugs:' . $incrementor ); 1298 wp_cache_add( $term->name, $term->term_id, $taxonomy . ':names:' . $incrementor ); 1299 1299 $_term = $term; 1300 1300 } else { … … 1307 1307 if ( ! $_term ) 1308 1308 return null; 1309 wp_cache_add( $term, $_term, $taxonomy );1310 wp_cache_add( "slug:{$_term->slug}", $term, $group);1311 wp_cache_add( "name:" . md5( $_term->name ), $term, $group);1309 wp_cache_add( $term, $_term, $taxonomy . ':terms:' . $incrementor ); 1310 wp_cache_add( $_term->slug, $term, $taxonomy . ':slugs:' . $incrementor ); 1311 wp_cache_add( $_term->name, $term, $taxonomy . ':names:' . $incrementor ); 1312 1312 } 1313 1313 } … … 1382 1382 1383 1383 $cache = false; 1384 $ group = $taxonomy . ':' . wp_get_last_changed('terms' );1384 $incrementor = wp_cache_get( 'last_changed', 'terms' ); 1385 1385 if ( 'slug' == $field ) { 1386 1386 $field = 't.slug'; … … 1389 1389 return false; 1390 1390 1391 $term_id = wp_cache_get( "slug:{$value}", $group);1391 $term_id = wp_cache_get( $value, $taxonomy . ':slugs:' . $incrementor ); 1392 1392 if ( $term_id ) { 1393 1393 $value = $term_id; … … 1398 1398 $value = wp_unslash($value); 1399 1399 $field = 't.name'; 1400 $term_id = wp_cache_get( "name:" . md5( $value ), $group);1400 $term_id = wp_cache_get( $value, $taxonomy . ':names:' . $incrementor ); 1401 1401 if ( $term_id ) { 1402 1402 $value = $term_id; … … 1430 1430 $term = sanitize_term($term, $taxonomy, $filter); 1431 1431 1432 wp_cache_add( $term->term_id, $term, $taxonomy );1433 wp_cache_add( "slug:{$term->slug}", $term->term_id, $group);1434 wp_cache_add( "name:" . md5( $term->name ), $term->term_id, $group);1432 wp_cache_add( $term->term_id, $term, $taxonomy . ':terms:' . $incrementor ); 1433 wp_cache_add( $term->slug, $term->term_id, $taxonomy . ':slugs:' . $incrementor ); 1434 wp_cache_add( $term->name, $term->term_id, $taxonomy . ':names:' . $incrementor ); 1435 1435 1436 1436 if ( $output == OBJECT ) { … … 3671 3671 } 3672 3672 3673 wp_ get_last_changed( 'terms', true);3673 wp_cache_set( 'last_changed', microtime(), 'terms' ); 3674 3674 } 3675 3675 … … 3777 3777 $term_taxonomy = $term->taxonomy; 3778 3778 3779 wp_cache_add( $term->term_id, $term, $term_taxonomy ); 3780 $group = $term_taxonomy . ':' . wp_get_last_changed( 'terms', true ); 3781 wp_cache_add( "slug:{$term->slug}", $term->term_id, $group ); 3782 wp_cache_add( "name:" . md5( $term->name ), $term->term_id, $group ); 3779 $incrementor = wp_cache_set( 'last_changed', microtime(), 'terms' ); 3780 3781 wp_cache_add( $term->term_id, $term, $term_taxonomy . ':terms:' . $incrementor ); 3782 wp_cache_add( $term->slug, $term->term_id, $taxonomy . ':slugs:' . $incrementor ); 3783 wp_cache_add( $term->name, $term->term_id, $taxonomy . ':names:' . $incrementor ); 3783 3784 } 3784 3785 }
Note: See TracChangeset
for help on using the changeset viewer.