Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/21/2014 05:51:10 PM (11 years ago)
Author:
boonebgorges
Message:

Overhaul the way that individual group objects are cached

The existing implementation was broken in a number of ways. Most critically,
user-specific data (like is_member) was being stored in the persistent object
cache without respect to user.

This refactor excludes the user-specific data from being cached along with the
group object. It also reworks the way that items are keyed in the cache, for
greater consistency with WordPress and the other BP components.

See #5407

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/testcases/groups/functions.php

    r7903 r7956  
    549549        $this->assertNotEmpty( groups_add_groupmeta( $g, 'foo', 'baz' ) );
    550550    }
     551
     552    /**
     553     * @group groups_get_group
     554     * @group cache
     555     */
     556    public function test_groups_get_group_cache_different_users() {
     557        $g = $this->factory->group->create();
     558        $u1 = $this->create_user();
     559        $u2 = $this->create_user();
     560        $this->add_user_to_group( $u1, $g );
     561
     562        $old_user = get_current_user_id();
     563        $this->set_current_user( $u1 );
     564
     565        $group1 = groups_get_group( array( 'group_id' => $g, ) );
     566
     567        $this->set_current_user( $u2 );
     568
     569        $group2 = groups_get_group( array( 'group_id' => $g, ) );
     570
     571        $this->assertNotEquals( $group1, $group2 );
     572
     573        $this->set_current_user( $old_user );
     574    }
    551575}
Note: See TracChangeset for help on using the changeset viewer.