Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/01/2016 03:27:12 AM (8 years ago)
Author:
boonebgorges
Message:

Cache the results of activity ID and count queries.

Query results are cached using an incrementor, and are invalidated in
bulk whenever an activity item is created, updated, or deleted.

Fixes #7237.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-cache.php

    r10455 r11054  
    6464}
    6565add_action( 'bp_activity_deleted_activities', 'bp_activity_clear_cache_for_deleted_activity' );
     66
     67/**
     68 * Reset cache incrementor for the Activity component.
     69 *
     70 * Called whenever an activity item is created, updated, or deleted, this
     71 * function effectively invalidates all cached results of activity queries.
     72 *
     73 * @since 2.7.0
     74 *
     75 * @return bool True on success, false on failure.
     76 */
     77function bp_activity_reset_cache_incrementor() {
     78    return bp_core_reset_incrementor( 'bp_activity' );
     79}
     80add_action( 'bp_activity_delete', 'bp_activity_reset_cache_incrementor' );
     81add_action( 'bp_activity_add', 'bp_activity_reset_cache_incrementor' );
Note: See TracChangeset for help on using the changeset viewer.