Skip to:
Content

BuddyPress.org

Changeset 2617 for trunk/bp-core.php


Ignore:
Timestamp:
02/07/2010 03:21:39 PM (16 years ago)
Author:
apeatling
Message:

Added proper caching to object count and meta functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r2576 r2617  
    12021202        global $wpdb, $bp;
    12031203
    1204         $status_sql = bp_core_get_status_sql();
    1205 
    1206         $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM " . CUSTOM_USER_TABLE . " WHERE {$status_sql}" ) );
     1204        if ( !$count = wp_cache_get( 'bp_total_member_count', 'bp' ) ) {
     1205                $status_sql = bp_core_get_status_sql();
     1206                $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM " . CUSTOM_USER_TABLE . " WHERE {$status_sql}" ) );
     1207        }
     1208
    12071209        return apply_filters( 'bp_core_get_total_member_count', $count );
    12081210}
Note: See TracChangeset for help on using the changeset viewer.