Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/19/2017 05:05:18 AM (8 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/tests/phpunit/testcases/admin/tools.php

    r6524 r6585  
    161161        bbp_admin_repair_topic_voice_count();
    162162
    163         bbp_clean_post_cache( $t );
     163        clean_post_cache( $t );
    164164
    165165        $count = bbp_get_topic_voice_count( $t );
     
    215215        bbp_admin_repair_topic_hidden_reply_count();
    216216
    217         bbp_clean_post_cache( $t );
     217        clean_post_cache( $t );
    218218
    219219        $count = bbp_get_topic_reply_count_hidden( $t, true );
     
    662662        bbp_admin_repair_forum_meta();
    663663
    664         bbp_clean_post_cache( $f );
    665         bbp_clean_post_cache( $t );
    666         bbp_clean_post_cache( $r );
     664        clean_post_cache( $f );
     665        clean_post_cache( $t );
     666        clean_post_cache( $r );
    667667
    668668        // Forums should NOT have a _bbp_forum_id meta key
Note: See TracChangeset for help on using the changeset viewer.