Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/15/2015 10:44:55 PM (9 years ago)
Author:
r-a-y
Message:

Messages: Cache calls to BP_Messages_Thread class.

This commit:

  • Introduces static method - BP_Messages_Thread::get_messages() - caches fetching messages by thread ID and introduces the 'bp_messages_threads' cache group.
  • Converts BP_Messages_Thread::check_access() and BP_Messages_Thread::is_valid() methods from using direct DB queries to reference the cache.
  • Includes unit tests.
  • Consolidates cache clearing functions in bp-messages-cache.php.

This handles the majority of uncached message DB queries. For the inbox
page, if there are 10 message threads in the loop, we save 20 DB queries.
On a single message thread, we save 5 DB queries.

Fixes #6221.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/bp-messages-loader.php

    r9351 r9753  
    304304        wp_cache_add_global_groups( array(
    305305            'bp_messages',
     306            'bp_messages_threads',
    306307            'bp_messages_unread_count',
    307308            'message_meta'
Note: See TracChangeset for help on using the changeset viewer.