Changeset 60697 for trunk/src/wp-includes/class-wp-query.php
- Timestamp:
- 08/31/2025 09:41:54 PM (6 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-query.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-query.php
r60444 r60697 2883 2883 2884 2884 $key = md5( $comments_request ); 2885 $last_changed = wp_cache_get_last_changed( 'comment' ) . ':' . wp_cache_get_last_changed( 'posts' ); 2886 2887 $cache_key = "comment_feed:$key:$last_changed"; 2888 $comment_ids = wp_cache_get( $cache_key, 'comment-queries' ); 2885 $last_changed = array( 2886 wp_cache_get_last_changed( 'comment' ), 2887 wp_cache_get_last_changed( 'posts' ), 2888 ); 2889 2890 $cache_key = "comment_feed:$key"; 2891 $comment_ids = wp_cache_get_salted( $cache_key, 'comment-queries', $last_changed ); 2889 2892 if ( false === $comment_ids ) { 2890 2893 $comment_ids = $wpdb->get_col( $comments_request ); 2891 wp_cache_ add( $cache_key, $comment_ids, 'comment-queries');2894 wp_cache_set_salted( $cache_key, $comment_ids, 'comment-queries', $last_changed ); 2892 2895 } 2893 2896 _prime_comment_caches( $comment_ids ); … … 3247 3250 } 3248 3251 3252 $last_changed = (array) wp_cache_get_last_changed( 'posts' ); 3253 if ( ! empty( $this->tax_query->queries ) ) { 3254 $last_changed[] = wp_cache_get_last_changed( 'terms' ); 3255 } 3256 3249 3257 if ( $q['cache_results'] && $id_query_is_cacheable ) { 3250 3258 $new_request = str_replace( $fields, "{$wpdb->posts}.*", $this->request ); … … 3253 3261 $cache_found = false; 3254 3262 if ( null === $this->posts ) { 3255 $cached_results = wp_cache_get ( $cache_key, 'post-queries', false, $cache_found );3263 $cached_results = wp_cache_get_salted( $cache_key, 'post-queries', $last_changed ); 3256 3264 3257 3265 if ( $cached_results ) { 3266 $cache_found = true; 3258 3267 /** @var int[] */ 3259 3268 $post_ids = array_map( 'intval', $cached_results['posts'] ); … … 3313 3322 ); 3314 3323 3315 wp_cache_set ( $cache_key, $cache_value, 'post-queries');3324 wp_cache_set_salted( $cache_key, $cache_value, 'post-queries', $last_changed ); 3316 3325 } 3317 3326 … … 3351 3360 ); 3352 3361 3353 wp_cache_set ( $cache_key, $cache_value, 'post-queries');3362 wp_cache_set_salted( $cache_key, $cache_value, 'post-queries', $last_changed ); 3354 3363 } 3355 3364 … … 3449 3458 ); 3450 3459 3451 wp_cache_set ( $cache_key, $cache_value, 'post-queries');3460 wp_cache_set_salted( $cache_key, $cache_value, 'post-queries', $last_changed ); 3452 3461 } 3453 3462 … … 3487 3496 $comment_last_changed = wp_cache_get_last_changed( 'comment' ); 3488 3497 3489 $comment_cache_key = "comment_feed:$comment_key :$comment_last_changed";3490 $comment_ids = wp_cache_get ( $comment_cache_key, 'comment-queries');3498 $comment_cache_key = "comment_feed:$comment_key"; 3499 $comment_ids = wp_cache_get_salted( $comment_cache_key, 'comment-queries', $comment_last_changed ); 3491 3500 if ( false === $comment_ids ) { 3492 3501 $comment_ids = $wpdb->get_col( $comments_request ); 3493 wp_cache_ add( $comment_cache_key, $comment_ids, 'comment-queries');3502 wp_cache_set_salted( $comment_cache_key, $comment_ids, 'comment-queries', $comment_last_changed ); 3494 3503 } 3495 3504 _prime_comment_caches( $comment_ids ); … … 5063 5072 $key = md5( serialize( $args ) . $sql ); 5064 5073 5065 $last_changed = wp_cache_get_last_changed( 'posts' ); 5066 if ( ! empty( $this->tax_query->queries ) ) { 5067 $last_changed .= wp_cache_get_last_changed( 'terms' ); 5068 } 5069 5070 $this->query_cache_key = "wp_query:$key:$last_changed"; 5074 $this->query_cache_key = "wp_query:$key"; 5071 5075 return $this->query_cache_key; 5072 5076 }
Note: See TracChangeset
for help on using the changeset viewer.