Ticket #40669: 40669.diff
File 40669.diff, 5.5 KB (added by , 7 years ago) |
---|
-
src/wp-includes/class-wp-comment-query.php
394 394 // $args can include anything. Only use the args defined in the query_var_defaults to compute the key. 395 395 $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) ); 396 396 $last_changed = wp_cache_get_last_changed( 'comment' ); 397 397 // Cache bust if a meta query. 398 if ( ! empty( $args['meta_query'] ) || ! empty( $args['meta_key'] ) ) { 399 $last_changed_meta = wp_cache_get_last_changed( 'comment_meta' ); 400 $last_changed .= ":" . $last_changed_meta; 401 } 398 402 399 403 $cache_key = "get_comments:$key:$last_changed"; 400 404 $cache_value = wp_cache_get( $cache_key, 'comment' ); … … 948 952 949 953 $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) ); 950 954 $last_changed = wp_cache_get_last_changed( 'comment' ); 951 955 // Cache bust if a meta query. 956 if ( ! empty( $this->query_vars['meta_query'] ) || ! empty( $this->query_vars['meta_key'] ) ) { 957 $last_changed_meta = wp_cache_get_last_changed( 'comment_meta' ); 958 $last_changed .= ":" . $last_changed_meta; 959 } 952 960 // Fetch an entire level of the descendant tree at a time. 953 961 $level = 0; 954 962 $exclude_keys = array( 'parent', 'parent__in', 'parent__not_in' ); -
src/wp-includes/class-wp-term-query.php
675 675 // $args can be anything. Only use the args defined in defaults to compute the key. 676 676 $key = md5( serialize( wp_array_slice_assoc( $args, array_keys( $this->query_var_defaults ) ) ) . serialize( $taxonomies ) . $this->request ); 677 677 $last_changed = wp_cache_get_last_changed( 'terms' ); 678 // Cache bust if a meta query. 679 if ( ! empty( $args['meta_query'] ) || ! empty( $args['meta_key'] ) ) { 680 $last_changed_meta = wp_cache_get_last_changed( 'term_meta' ); 681 $last_changed .= ":" . $last_changed_meta; 682 } 678 683 $cache_key = "get_terms:$key:$last_changed"; 679 684 $cache = wp_cache_get( $cache_key, 'terms' ); 680 685 if ( false !== $cache ) { -
src/wp-includes/meta.php
104 104 105 105 $mid = (int) $wpdb->insert_id; 106 106 107 wp_cache_delete($object_id, $meta_type . '_meta'); 107 $cache_group = $meta_type . '_meta'; 108 wp_cache_set( 'last_changed', microtime(), $cache_group ); 109 wp_cache_delete( $object_id, $cache_group ); 108 110 109 111 /** 110 112 * Fires immediately after meta of a specific type is added. … … 248 250 if ( ! $result ) 249 251 return false; 250 252 251 wp_cache_delete($object_id, $meta_type . '_meta'); 253 $cache_group = $meta_type . '_meta'; 254 wp_cache_set( 'last_changed', microtime(), $cache_group ); 255 wp_cache_delete( $object_id, $cache_group ); 252 256 253 257 foreach ( $meta_ids as $meta_id ) { 254 258 /** … … 406 410 if ( !$count ) 407 411 return false; 408 412 413 $cache_group = $meta_type . '_meta'; 414 wp_cache_set( 'last_changed', microtime(), $cache_group ); 409 415 if ( $delete_all ) { 410 416 foreach ( (array) $object_ids as $o_id ) { 411 wp_cache_delete( $o_id, $meta_type . '_meta');417 wp_cache_delete( $o_id, $cache_group ); 412 418 } 413 419 } else { 414 wp_cache_delete( $object_id, $meta_type . '_meta');420 wp_cache_delete( $object_id, $cache_group ); 415 421 } 416 422 423 417 424 /** 418 425 * Fires immediately after deleting metadata of a specific type. 419 426 * … … 670 677 return false; 671 678 672 679 // Clear the caches. 673 wp_cache_delete($object_id, $meta_type . '_meta'); 680 $cache_group = $meta_type . '_meta'; 681 wp_cache_set( 'last_changed', microtime(), $cache_group ); 682 wp_cache_delete( $object_id, $cache_group ); 674 683 675 684 /** This action is documented in wp-includes/meta.php */ 676 685 do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); … … 746 755 $result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ) ); 747 756 748 757 // Clear the caches. 749 wp_cache_delete($object_id, $meta_type . '_meta'); 758 $cache_group = $meta_type . '_meta'; 759 wp_cache_set( 'last_changed', microtime(), $cache_group ); 760 wp_cache_delete( $object_id, $cache_group ); 750 761 751 762 /** This action is documented in wp-includes/meta.php */ 752 763 do_action( "deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value ); -
src/wp-includes/taxonomy.php
1130 1130 1131 1131 $added = add_metadata( 'term', $term_id, $meta_key, $meta_value, $unique ); 1132 1132 1133 // Bust term query cache.1134 if ( $added ) {1135 wp_cache_set( 'last_changed', microtime(), 'terms' );1136 }1137 1138 1133 return $added; 1139 1134 } 1140 1135 … … 1156 1151 1157 1152 $deleted = delete_metadata( 'term', $term_id, $meta_key, $meta_value ); 1158 1153 1159 // Bust term query cache.1160 if ( $deleted ) {1161 wp_cache_set( 'last_changed', microtime(), 'terms' );1162 }1163 1164 1154 return $deleted; 1165 1155 } 1166 1156 … … 1212 1202 1213 1203 $updated = update_metadata( 'term', $term_id, $meta_key, $meta_value, $prev_value ); 1214 1204 1215 // Bust term query cache.1216 if ( $updated ) {1217 wp_cache_set( 'last_changed', microtime(), 'terms' );1218 }1219 1220 1205 return $updated; 1221 1206 } 1222 1207