Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/27/2014 07:04:30 PM (10 years ago)
Author:
r-a-y
Message:

Notifications: Invalidate cache when a notification is updated.

Object caching was added to the notifications component in r7813.
However, the cached item was not invalidated whenever a notification
is updated (either by using one of the marked as read functions or via
using the BP_Notifications_Notification::update() method).

This commit invalidates the cache directly in the update() class
method and adds a unit test.

See #5377

File:
1 edited

Legend:

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

    r8171 r8176  
    662662        $where  = self::get_query_clauses( $where_args  );
    663663
     664        // make sure we delete the notification cache for the user on update
     665        if ( ! empty( $where_args['user_id'] ) ) {
     666            wp_cache_delete( 'all_for_user_' . $where_args['user_id'], 'bp_notifications' );
     667        }
     668
    664669        return self::_update( $update['data'], $where['data'], $update['format'], $where['format'] );
    665670    }
Note: See TracChangeset for help on using the changeset viewer.