Skip to:
Content

BuddyPress.org

Changeset 1238 for trunk/bp-friends.php


Ignore:
Timestamp:
03/19/2009 01:35:32 PM (17 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-friends.php

    r1227 r1238  
    619619add_action( 'delete_user', 'friends_remove_data', 1 );
    620620
     621function friends_clear_friend_object_cache( $friendship_id ) {
     622    if ( !$friendship = new BP_Friends_Friendship( $friendship_id ) )
     623        return false;
     624
     625    wp_cache_delete( 'friends_friend_ids_' . $friendship->initiator_user_id, 'bp' );
     626    wp_cache_delete( 'friends_friend_ids_' . $friendship->friend_user_id, 'bp' );
     627    wp_cache_delete( 'popular_users', 'bp' );
     628}
     629
     630// List actions to clear object caches on
     631add_action( 'friends_friendship_accepted', 'friends_clear_friend_object_cache' );
     632add_action( 'friends_friendship_deleted', 'friends_clear_friend_object_cache' );
     633
    621634// List actions to clear super cached pages on, if super cache is installed
    622635add_action( 'friends_friendship_rejected', 'bp_core_clear_cache' );
Note: See TracChangeset for help on using the changeset viewer.