Skip to:
Content

BuddyPress.org

Timestamp:
02/06/2014 08:33:50 PM (6 years ago)
Author:
boonebgorges
Message:

Object caching for the more frequently used items in bp-notifications

Several notifications queries are made on every pageload:

  • an unread count to set up navigation
  • an unread count for the toolbar
  • the notification items themselves for the toolbar

These three queries actually result in the identical SQL query, so we can
eliminate two of them by caching the value by the pageload. With persistent
caching, the performance benefits are obviously even greater.

The chosen technique for caching here is 'all_for_user_'. This makes
invalidation fairly straightforward, because we can simply bust the
'all_for_user_x' cache whenever a save or delete takes place on a notification
item that is related to user_x. For more complex parts of the notification
component (such as the notifications page itself), if caching is desired,
it'll probably make sense to split the query and cache individual items.

Fixes #5377

File:
1 added

Note: See TracChangeset for help on using the changeset viewer.