Skip to:
Content

BuddyPress.org

Changeset 11165


Ignore:
Timestamp:
09/28/2016 04:25:40 AM (8 years ago)
Author:
r-a-y
Message:

Legacy Forums: Fix persistent caching issue with bbPress v1.2.

For the legacy forums component, we bundle bbPress v1.2, which includes
BackPress. BackPress uses its own version of wp_cache_flush() that
allows for clearing cache groups:
https://backpress.trac.wordpress.org/browser/trunk/includes/functions.wp-object-cache.php?marks=77,80#L67

bbPress v1 uses this syntax for wp_cache_flush() throughout its codebase:
https://bbpress.trac.wordpress.org/browser/tags/1.2/bb-includes/functions.bb-posts.php?marks=452-454#L449
https://bbpress.trac.wordpress.org/browser/tags/1.2/bb-includes/functions.bb-topics.php?marks=218-219,226-228#L213

However, WordPress' version of wp_cache_flush() does not support clearing
cache groups. This causes various cache invalidation issues as bbPress v1
(incorrectly) assumes that those using a persistent object cache plugin
will support cache group clearing.

To workaround this, we intentionally tell WordPress not to use the
following cache groups as persistent - bb_forums, bb_query, bb_post,
and bb_cache_posts_post_ids.

Props wpdennis, r-a-y.

Fixes #4522, #4759.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-forums/bp-forums-loader.php

    r10821 r11165  
    269269        parent::setup_title();
    270270    }
     271
     272    /**
     273     * Disable cache groups due to a caching discrepancy in BackPress.
     274     *
     275     * @since 2.7.0
     276     * @see   https://buddypress.trac.wordpress.org/ticket/4759
     277     */
     278    public function setup_cache_groups() {
     279        wp_cache_add_non_persistent_groups( array(
     280            // Posts.
     281            'bb_forums',
     282            'bb_query',
     283            'bb_cache_posts_post_ids',
     284
     285            // Topics
     286            'bb_post'
     287        ) );
     288    }
    271289}
    272290
Note: See TracChangeset for help on using the changeset viewer.