[buddypress-trac] [BuddyPress Trac] #5377: Cache some frequently used values in notifications component

buddypress-trac noreply at wordpress.org
Thu Feb 6 20:33:51 UTC 2014

#5377: Cache some frequently used values in notifications component
 Reporter:  boonebgorges   |       Owner:  boonebgorges
     Type:  enhancement    |      Status:  closed
 Priority:  normal         |   Milestone:  2.0
Component:  Notifications  |     Version:
 Severity:  normal         |  Resolution:  fixed
 Keywords:                 |
Changes (by boonebgorges):

 * owner:   => boonebgorges
 * status:  new => closed
 * resolution:   => fixed


 In [changeset:"7813"]:
 #!CommitTicketReference repository="" revision="7813"
 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
 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
 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

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5377#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list