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/cache.php

    r7843 r7956  
    7474
    7575        // Prime cache
    76         groups_get_group( array( 'group_id' => $g ) );
     76        groups_get_group( array( 'group_id' => $g, ) );
    7777
    78         $this->assertNotEmpty( wp_cache_get( 'bp_groups_group_' . $g . '_noload_users', 'bp' ) );
     78        $this->assertNotEmpty( wp_cache_get( $g, 'bp_groups' ) );
    7979
    8080        // Trigger flush
    8181        groups_update_groupmeta( $g, 'foo', 'bar' );
    8282
    83         $this->assertFalse( wp_cache_get( 'bp_groups_group_' . $g . '_noload_users', 'bp' ) );
     83        $this->assertFalse( wp_cache_get( $g, 'bp_groups' ) );
    8484    }
    8585
     
    9595        groups_get_group( array( 'group_id' => $g ) );
    9696
    97         $this->assertNotEmpty( wp_cache_get( 'bp_groups_group_' . $g . '_noload_users', 'bp' ) );
     97        $this->assertNotEmpty( wp_cache_get( $g, 'bp_groups' ) );
    9898
    9999        // Trigger flush
    100100        groups_update_groupmeta( $g, 'foo', 'baz' );
    101         $this->assertFalse( wp_cache_get( 'bp_groups_group_' . $g . '_noload_users', 'bp' ) );
     101        $this->assertFalse( wp_cache_get( $g, 'bp_groups' ) );
    102102    }
    103103
Note: See TracChangeset for help on using the changeset viewer.