Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/19/2017 05:05:18 AM (9 years ago)
Author:
johnjamesjacoby
Message:

Cache: make bbp_clean_post_cache() an action-only function.

Instead of calling bbp_clean_post_cache() directly, we'll call clean_post_cache() as per normal and hook bbp_clean_post_cache() to the end of it. This reduces a bunch of superfluous cache invalidation from occurring back-to-back.

We'll also only ever update the last_changed cache key when we've reached the forum-root. This makes sure that subsequent recursive calls up the post_parent tree are dealing with the same last_changed value until the end.

This change will reduce the number of cache invalidation calls by a large amount, improving functional performance for database writes to the post & postmeta tables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/forums/functions.php

    r6583 r6585  
    833833        $bbp_db->update( $bbp_db->posts, array( 'post_status' => bbp_get_public_status_id() ), array( 'ID' => $forum_id ) );
    834834        wp_transition_post_status( bbp_get_public_status_id(), $current_visibility, get_post( $forum_id ) );
    835         bbp_clean_post_cache( $forum_id );
     835        clean_post_cache( $forum_id );
    836836    }
    837837
     
    882882        $bbp_db->update( $bbp_db->posts, array( 'post_status' => bbp_get_private_status_id() ), array( 'ID' => $forum_id ) );
    883883        wp_transition_post_status( bbp_get_private_status_id(), $current_visibility, get_post( $forum_id ) );
    884         bbp_clean_post_cache( $forum_id );
     884        clean_post_cache( $forum_id );
    885885    }
    886886
     
    931931        $bbp_db->update( $bbp_db->posts, array( 'post_status' => bbp_get_hidden_status_id() ), array( 'ID' => $forum_id ) );
    932932        wp_transition_post_status( bbp_get_hidden_status_id(), $current_visibility, get_post( $forum_id ) );
    933         bbp_clean_post_cache( $forum_id );
     933        clean_post_cache( $forum_id );
    934934    }
    935935
Note: See TracChangeset for help on using the changeset viewer.