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/core/actions.php

    r6551 r6585  
    385385add_action( 'bbp_user_edit_after', 'bbp_user_edit_after' );
    386386
    387 // New forum/topic/reply caches
    388 // @todo Investigate why clearing is necessary on both pre & post hooks
    389 add_action( 'bbp_new_forum_pre_extras',  'bbp_clean_post_cache' );
    390 add_action( 'bbp_new_forum_post_extras', 'bbp_clean_post_cache' );
    391 add_action( 'bbp_new_topic_pre_extras',  'bbp_clean_post_cache' );
    392 add_action( 'bbp_new_topic_post_extras', 'bbp_clean_post_cache' );
    393 add_action( 'bbp_new_reply_pre_extras',  'bbp_clean_post_cache' );
    394 add_action( 'bbp_new_reply_post_extras', 'bbp_clean_post_cache' );
    395 
    396387// Clean bbPress post caches when WordPress's is cleaned
    397388add_action( 'clean_post_cache', 'bbp_clean_post_cache', 10, 2 );
Note: See TracChangeset for help on using the changeset viewer.