Ticket #22176: 22176.diff

File 22176.diff, 1.3 KB (added by ryan, 8 months ago)

The gist

  • wp-includes/post.php

     
    45074507                wp_cache_delete( 'all_page_ids', 'posts' ); 
    45084508                do_action( 'clean_page_cache', $post->ID ); 
    45094509        } 
     4510 
     4511        if ( function_exists( 'wp_cache_incr' ) ) { 
     4512                wp_cache_incr( 'last_changed', 1, 'posts' ); 
     4513        } else { 
     4514                $last_changed = wp_cache_get( 'last_changed', 'posts' ); 
     4515                wp_cache_set( 'last_changed', $last_changed + 1, 'posts' ); 
     4516        } 
    45104517} 
    45114518 
    45124519/** 
  • wp-includes/query.php

     
    26612661 
    26622662                        $this->request = apply_filters( 'posts_request_ids', $this->request, $this ); 
    26632663 
    2664                         $ids = $wpdb->get_col( $this->request ); 
     2664                        $last_changed = wp_cache_get( 'last_changed', 'posts' ); 
     2665                        if ( ! $last_changed ) 
     2666                                $last_changed = wp_cache_set( 'last_changed', 1, 'posts' ); 
     2667                        $this->cache_key = md5( $this->request ) . $last_changed; 
    26652668 
     2669                        if ( ! $ids = wp_cache_get( $this->cache_key, 'posts' ) ) { 
     2670                                $ids = $wpdb->get_col( $this->request ); 
     2671                                wp_cache_set( $this->cache_key, $ids, 'posts' ); 
     2672                        } 
     2673 
    26662674                        if ( $ids ) { 
    26672675                                $this->posts = $ids; 
    26682676                                $this->set_found_posts( $q, $limits );