[buddypress-trac] [BuddyPress Trac] #5733: Use wp_cache_add_global_groups() so cache is applicable throughout multisite

buddypress-trac noreply at wordpress.org
Mon Dec 8 20:02:36 UTC 2014


#5733: Use wp_cache_add_global_groups() so cache is applicable throughout
multisite
--------------------------+-----------------------------
 Reporter:  wpdennis      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Core          |     Version:  2.0
 Severity:  minor         |  Resolution:
 Keywords:  2nd-opinion   |
--------------------------+-----------------------------

Comment (by r-a-y):

 Ran into a similar issue while working on a blog component plugin and
 needing to reference the blog meta on sub-sites.  I'm getting different
 returned results on each site with an object cache plugin enabled.

 We either need to use `switch_to_blog( bp_get_root_blog_id() )` /
 `restore_current_blog() inside our internal meta functions
 (`bp_blogs_get_blogmeta()`, `groups_get_groupmeta()`, etc.).

 The alternative is registering our meta cache groups to the global object
 cache groups:

 * `'blog_meta'`
 * `'activity_meta'`
 * `'group_meta'`
 * `'message_meta'`
 * `'xprofile_meta'`

 FWIW, WordPress registers `'user_meta'` as a global cache group.  The most
 important is `'blog_meta'` since it does make sense to actually check blog
 meta on a sub-site.  The rest are less important, but still valid.

 For now, I'm working around this by calling `switch_to_blog(
 bp_get_root_blog_id() )` before calling on our blog meta functions, but we
 do need to address this.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5733#comment:20>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list