[buddypress-trac] [BuddyPress Trac] #6567: Cache issue on bp directory pages with multisite installtion
buddypress-trac
noreply at wordpress.org
Tue Jul 28 17:55:15 UTC 2015
#6567: Cache issue on bp directory pages with multisite installtion
-------------------------------+----------------------------------
Reporter: mhawksey | Owner: johnjamesjacoby
Type: enhancement | Status: assigned
Priority: normal | Milestone: Under Consideration
Component: Component - Core | Version: 1.1
Severity: normal | Resolution:
Keywords: reporter-feedback |
-------------------------------+----------------------------------
Changes (by johnjamesjacoby):
* keywords: => reporter-feedback
* owner: => johnjamesjacoby
* version: 2.3.2 => 1.1
* status: new => assigned
* type: defect (bug) => enhancement
Comment:
Hi mhawksey,
Thanks for creating this ticket, and congrats on your first!
You're correct that this global cache group is not ideal, and there are a
few places that still use it that should probably get moved off.
If you're taking advantage of WordPress's `object-cache.php` drop-in,
something like this in your `build_key( $key, $group )` method should
clear everything up for you:
{{{
// Check for BuddyPress cache groups
if ( ( 'bp' === $group ) || ( 'bp_' === substr( $group, 0, 3 ) ) ||
in_array( $group, array( 'activity_meta', 'blog_meta', 'group_meta',
'message_meta', 'notification_meta', 'xprofile_meta' ) ) ) {
// Prefix the network ID
$network_id = get_current_site()->id;
$group = "network_{$network_id}:{$group}";
}
}}}
In the above snippet, you can see that we are targeting all BuddyPress
specific cache groups, and keying them by the `$network_id` vs. the
blog/site ID. If you're using the BP Multi Network plugin, this is
probably the way to go, as it ensures each network activated BuddyPress
setup gets its own unique cache prefix based on the ID of the network that
all other sites are connected to.
The problem with this snippet is, frankly, the burden of maintaining a
white-list of cache groups. We've talked about trying to include helper
functions for this in the past, but there are so few people this impacts
that we haven't talked very seriously about it in a long while.
Try this out, and please report back if it's working as intended, or if I
can help in some other way. If you can identify an improvement to
BuddyPress core, I'd also like to chat more about what that looks like
here.
I also have an updated fork of the BP Multi Network plugin available on
Github, that you might have better luck with:
https://github.com/johnjamesjacoby/bp-multi-network
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6567#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list