Changeset 52707
- Timestamp:
- 02/11/2022 06:50:08 PM (3 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-comment-query.php
r52332 r52707 1059 1059 } 1060 1060 1061 $data = array(); 1061 1062 foreach ( $parent_map as $parent_id => $children ) { 1062 $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed"; 1063 wp_cache_set( $cache_key, $children, 'comment' ); 1064 } 1063 $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed"; 1064 $data[ $cache_key ] = $children; 1065 } 1066 wp_cache_set_multiple( $data, 'comment' ); 1065 1067 } 1066 1068 -
trunk/src/wp-includes/comment.php
r52332 r52707 1884 1884 function _clear_modified_cache_on_transition_comment_status( $new_status, $old_status ) { 1885 1885 if ( 'approved' === $new_status || 'approved' === $old_status ) { 1886 $data = array(); 1886 1887 foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { 1887 wp_cache_delete( "lastcommentmodified:$timezone", 'timeinfo' ); 1888 } 1888 $data[] = "lastcommentmodified:$timezone"; 1889 } 1890 wp_cache_delete_multiple( $data, 'timeinfo' ); 1889 1891 } 1890 1892 } … … 2046 2048 wp_update_comment_count( $comment_post_ID ); 2047 2049 2050 $data = array(); 2048 2051 foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { 2049 wp_cache_delete( "lastcommentmodified:$timezone", 'timeinfo' ); 2050 } 2052 $data[] = "lastcommentmodified:$timezone"; 2053 } 2054 wp_cache_delete_multiple( $data, 'timeinfo' ); 2051 2055 } 2052 2056 … … 3221 3225 */ 3222 3226 function clean_comment_cache( $ids ) { 3223 foreach ( (array) $ids as $id ) {3224 wp_cache_delete( $id, 'comment' );3225 3227 $comment_ids = (array) $ids; 3228 wp_cache_delete_multiple( $comment_ids, 'comment' ); 3229 foreach ( $comment_ids as $id ) { 3226 3230 /** 3227 3231 * Fires immediately after a comment has been removed from the object cache. … … 3251 3255 */ 3252 3256 function update_comment_cache( $comments, $update_meta_cache = true ) { 3257 $data = array(); 3253 3258 foreach ( (array) $comments as $comment ) { 3254 wp_cache_add( $comment->comment_ID, $comment, 'comment' ); 3255 } 3259 $data[ $comment->comment_ID ] = $comment; 3260 } 3261 wp_cache_add_multiple( $data, 'comment' ); 3256 3262 3257 3263 if ( $update_meta_cache ) { -
trunk/src/wp-includes/meta.php
r52140 r52707 497 497 498 498 if ( $delete_all ) { 499 foreach ( (array) $object_ids as $o_id ) { 500 wp_cache_delete( $o_id, $meta_type . '_meta' ); 501 } 499 $data = (array) $object_ids; 502 500 } else { 503 wp_cache_delete( $object_id, $meta_type . '_meta' ); 504 } 501 $data = array( $object_id ); 502 } 503 wp_cache_delete_multiple( $data, $meta_type . '_meta' ); 505 504 506 505 /** … … 1192 1191 } 1193 1192 1193 $data = array(); 1194 1194 foreach ( $non_cached_ids as $id ) { 1195 1195 if ( ! isset( $cache[ $id ] ) ) { 1196 1196 $cache[ $id ] = array(); 1197 1197 } 1198 wp_cache_add( $id, $cache[ $id ], $cache_key ); 1199 } 1198 $data[ $id ] = $cache[ $id ]; 1199 } 1200 wp_cache_add_multiple( $data, $cache_key ); 1200 1201 1201 1202 return $cache; -
trunk/src/wp-includes/ms-network.php
r49193 r52707 83 83 } 84 84 85 foreach ( (array) $ids as $id ) {86 wp_cache_delete( $id, 'networks' );85 $network_ids = (array) $ids; 86 wp_cache_delete_multiple( $network_ids, 'networks' ); 87 87 88 foreach ( $network_ids as $id ) { 88 89 /** 89 90 * Fires immediately after a network has been removed from the object cache. … … 111 112 */ 112 113 function update_network_cache( $networks ) { 114 $data = array(); 113 115 foreach ( (array) $networks as $network ) { 114 wp_cache_add( $network->id, $network, 'networks' );116 $data[ $network->id ] = $network; 115 117 } 118 wp_cache_add_multiple( $data, 'networks' ); 116 119 } 117 120 -
trunk/src/wp-includes/ms-site.php
r52205 r52707 372 372 return; 373 373 } 374 $site_ids = array(); 374 $site_ids = array(); 375 $site_data = array(); 376 $blog_details_data = array(); 375 377 foreach ( $sites as $site ) { 376 $site_ids[] = $site->blog_id; 377 wp_cache_add( $site->blog_id, $site, 'sites' ); 378 wp_cache_add( $site->blog_id . 'short', $site, 'blog-details' ); 379 } 378 $site_ids[] = $site->blog_id; 379 $site_data[ $site->blog_id ] = $site; 380 $blog_details_data[ $site->blog_id . 'short' ] = $site; 381 382 } 383 wp_cache_add_multiple( $site_data, 'sites' ); 384 wp_cache_add_multiple( $blog_details_data, 'blog-details' ); 380 385 381 386 if ( $update_meta_cache ) { -
trunk/src/wp-includes/option.php
r52694 r52707 345 345 $options = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $network_id ) ); 346 346 347 $data = array(); 347 348 foreach ( $options as $option ) { 348 349 $key = $option->meta_key; … … 350 351 $option->meta_value = maybe_unserialize( $option->meta_value ); 351 352 352 wp_cache_set( $cache_key, $option->meta_value, 'site-options' ); 353 } 353 $data[ $cache_key ] = $option->meta_value; 354 } 355 wp_cache_set_multiple( $data, 'site-options' ); 354 356 } 355 357 -
trunk/src/wp-includes/post.php
r52691 r52707 7369 7369 } 7370 7370 7371 $data = array(); 7371 7372 foreach ( $posts as $post ) { 7372 wp_cache_add( $post->ID, $post, 'posts' ); 7373 } 7373 $data[ $post->ID ] = $post; 7374 } 7375 wp_cache_add_multiple( $data, 'posts' ); 7374 7376 } 7375 7377 -
trunk/src/wp-includes/taxonomy.php
r52669 r52707 3513 3513 $taxonomies = get_object_taxonomies( $object_type ); 3514 3514 3515 foreach ( $object_ids as $id ) { 3516 foreach ( $taxonomies as $taxonomy ) { 3517 wp_cache_delete( $id, "{$taxonomy}_relationships" ); 3518 } 3515 foreach ( $taxonomies as $taxonomy ) { 3516 wp_cache_delete_multiple( $object_ids, "{$taxonomy}_relationships" ); 3519 3517 } 3520 3518 … … 3568 3566 $taxonomies[] = $term->taxonomy; 3569 3567 $ids[] = $term->term_id; 3570 wp_cache_delete( $term->term_id, 'terms' ); 3571 } 3572 3568 } 3569 wp_cache_delete_multiple( $ids, 'terms' ); 3573 3570 $taxonomies = array_unique( $taxonomies ); 3574 3571 } else { 3572 wp_cache_delete_multiple( $ids, 'terms' ); 3575 3573 $taxonomies = array( $taxonomy ); 3576 3577 foreach ( $taxonomies as $taxonomy ) {3578 foreach ( $ids as $id ) {3579 wp_cache_delete( $id, 'terms' );3580 }3581 }3582 3574 } 3583 3575 … … 3753 3745 } 3754 3746 3747 $cache_values = array(); 3755 3748 foreach ( $object_terms as $id => $value ) { 3756 3749 foreach ( $value as $taxonomy => $terms ) { 3757 wp_cache_add( $id, $terms, "{$taxonomy}_relationships" ); 3758 } 3750 $cache_values[ $taxonomy ][ $id ] = $terms; 3751 } 3752 } 3753 foreach ( $cache_values as $taxonomy => $data ) { 3754 wp_cache_add_multiple( $data, "{$taxonomy}_relationships" ); 3759 3755 } 3760 3756 } … … 3769 3765 */ 3770 3766 function update_term_cache( $terms, $taxonomy = '' ) { 3767 $data = array(); 3771 3768 foreach ( (array) $terms as $term ) { 3772 3769 // Create a copy in case the array was passed by reference. … … 3776 3773 unset( $_term->object_id ); 3777 3774 3778 wp_cache_add( $term->term_id, $_term, 'terms' ); 3779 } 3775 $data[ $term->term_id ] = $_term; 3776 } 3777 wp_cache_add_multiple( $data, 'terms' ); 3780 3778 } 3781 3779
Note: See TracChangeset
for help on using the changeset viewer.