Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/27/2014 07:48:22 PM (11 years ago)
Author:
r-a-y
Message:

Properly set object cache for a new BP_Activity_Activity object.

This commit also renames the activity cache key and group to be
consistent with the groups component. (See r7956.)

See #5434.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-classes.php

    r7959 r7997  
    138138        global $wpdb, $bp;
    139139
    140         $row = wp_cache_get( 'activity_' . $this->id, 'bp' );
     140        $row = wp_cache_get( $this->id, 'bp_activity' );
    141141
    142142        if ( false === $row ) {
    143143            $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) );
     144
     145            wp_cache_set( $this->id, $row, 'bp_activity' );
    144146        }
    145147
     
    475477
    476478            // If cached data is found, use it
    477             if ( $activity_data = wp_cache_get( 'activity_' . $activity_id, 'bp' ) ) {
     479            if ( $activity_data = wp_cache_get( $activity_id, 'bp_activity' ) ) {
    478480                $activities[ $activity_id ] = $activity_data;
    479481
     
    499501            foreach ( (array) $queried_adata as $adata ) {
    500502                $activities[ $adata->id ] = $adata;
    501                 wp_cache_set( 'activity_' . $adata->id, $adata, 'bp' );
     503                wp_cache_set( $adata->id, $adata, 'bp_activity' );
    502504            }
    503505        }
Note: See TracChangeset for help on using the changeset viewer.