Skip to:
Content

BuddyPress.org

Changeset 1238 for trunk/bp-core.php


Ignore:
Timestamp:
03/19/2009 01:35:32 PM (16 years ago)
Author:
apeatling
Message:

Added basic object caching support ready for the first release. This will cut the number of database calls and load by 3x. Add define( 'WP_CACHE', true ); to you wp-config.php and drop object-cache.php into /wp-content/ to enable.

A good file based object cache is available here:
http://neosmart.net/dl.php?id=14

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r1236 r1238  
    13411341
    13421342function bp_core_print_generation_time() {
     1343    global $wpdb;
    13431344    ?>
    13441345<!-- Generated in <?php timer_stop(1); ?> seconds. -->
     
    13601361    /* Remove usermeta */
    13611362    delete_usermeta( $user_id, 'last_activity' );
     1363    wp_cache_flush();
    13621364}
    13631365add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 );
    13641366add_action( 'delete_user', 'bp_core_remove_data', 1 );
     1367
     1368function bp_core_clear_user_object_cache( $user_id ) {
     1369    wp_cache_delete( 'bp_user_' . $user_id, 'bp' );
     1370    wp_cache_delete( 'online_users' );
     1371    wp_cache_delete( 'newest_users' );
     1372}
     1373
     1374// List actions to clear object caches on
     1375add_action( 'bp_core_delete_avatar', 'bp_core_clear_user_object_cache' );
     1376add_action( 'bp_core_avatar_save', 'bp_core_clear_user_object_cache' );
    13651377
    13661378// List actions to clear super cached pages on, if super cache is installed
Note: See TracChangeset for help on using the changeset viewer.