Make WordPress Core


Ignore:
Timestamp:
02/09/2014 05:41:07 PM (13 years ago)
Author:
wonderboymusic
Message:

Reuse the terms cache group for taxonomy cache invalidation.

See #22526, #14485, [27101], [27102].

File:
1 edited

Legend:

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

    r27141 r27142  
    35173517 */
    35183518function get_taxonomy_last_changed( $taxonomy ) {
    3519         $last_changed = wp_cache_get( 'last_changed', $taxonomy );
     3519        $key = $taxonomy . '_last_changed';
     3520        $last_changed = wp_cache_get( $key, 'terms' );
    35203521        if ( ! $last_changed ) {
    35213522                $last_changed = microtime();
    3522                 wp_cache_set( 'last_changed', $last_changed, $taxonomy );
     3523                wp_cache_set( $key, $last_changed, 'terms' );
    35233524        }
    35243525        return $last_changed;
    … …  
    35343535 */
    35353536function set_taxonomy_last_changed( $taxonomy ) {
    3536         wp_cache_delete( 'last_changed', $taxonomy );
     3537        wp_cache_delete( $taxonomy . '_last_changed', 'terms' );
    35373538        return get_taxonomy_last_changed( $taxonomy );
    35383539}
    … …  
    35543555function post_taxonomy_is_fresh( $id, $taxonomy ) {
    35553556        $last_changed = get_taxonomy_last_changed( $taxonomy );
    3556         $post_last_changed = wp_cache_get( $id, $taxonomy . '_last_changed' );
     3557        $key = $id . '_' . $taxonomy . '_last_changed';
     3558        $post_last_changed = wp_cache_get( $key, 'terms' );
    35573559        if ( ! $post_last_changed || $last_changed !== $post_last_changed ) {
    3558                 wp_cache_set( $id, $last_changed, $taxonomy . '_last_changed' );
     3560                wp_cache_set( $key, $last_changed, 'terms' );
    35593561                return false;
    35603562        }
    … …  
    35783580function taxonomy_hierarchy_is_fresh( $taxonomy ) {
    35793581        $last_changed = get_taxonomy_last_changed( $taxonomy );
    3580         $hierarchy_last_changed = wp_cache_get( 'hierarchy_last_changed', $taxonomy );
     3582        $key = $taxonomy . '_hierarchy_last_changed';
     3583        $hierarchy_last_changed = wp_cache_get( $key, 'terms' );
    35813584        if ( ! $hierarchy_last_changed || $last_changed !== $hierarchy_last_changed ) {
    3582                 wp_cache_set( 'hierarchy_last_changed', $last_changed, $taxonomy );
     3585                wp_cache_set( $key, $last_changed, 'terms' );
    35833586                return false;
    35843587        }
Note: See TracChangeset for help on using the changeset viewer.