Changeset 9102
- Timestamp:
- 10/08/2008 10:50:46 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r8944 r9102 610 610 $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : ''; 611 611 $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); 612 613 if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) { 614 if ( isset( $cache[ $key ] ) ) { 615 $terms = apply_filters('get_terms', $cache[$key], $taxonomies, $args); 616 return $terms; 617 } 612 $last_changed = wp_cache_get('last_changed', 'terms'); 613 if ( !$last_changed ) { 614 $last_changed = time(); 615 wp_cache_set('last_changed', $last_changed, 'terms'); 616 } 617 $cache_key = "get_terms:$key:$last_changed"; 618 619 if ( $cache = wp_cache_get( $cache_key, 'terms' ) ) { 620 $terms = apply_filters('get_terms', $cache, $taxonomies, $args); 621 return $terms; 618 622 } 619 623 … … 747 751 reset ( $terms ); 748 752 749 $cache[ $key ] = $terms; 750 wp_cache_set( 'get_terms', $cache, 'terms' ); 753 wp_cache_add( $cache_key, $terms, 'terms' ); 751 754 752 755 $terms = apply_filters('get_terms', $terms, $taxonomies, $args); … … 1699 1702 function clean_term_cache($ids, $taxonomy = '') { 1700 1703 global $wpdb; 1704 static $cleaned = array(); 1701 1705 1702 1706 if ( !is_array($ids) ) … … 1721 1725 1722 1726 foreach ( $taxonomies as $taxonomy ) { 1727 if ( isset($cleaned[$taxonomy]) ) 1728 continue; 1729 $cleaned[$taxonomy] = true; 1723 1730 wp_cache_delete('all_ids', $taxonomy); 1724 1731 wp_cache_delete('get', $taxonomy); … … 1726 1733 } 1727 1734 1728 wp_cache_ delete('get_terms', 'terms');1735 wp_cache_set('last_changed', time(), 'terms'); 1729 1736 1730 1737 do_action('clean_term_cache', $ids, $taxonomy);
Note: See TracChangeset
for help on using the changeset viewer.