Opened 13 years ago
Closed 13 years ago
#3770 closed enhancement (fixed)
Support object cache in groups_get_group(), and use it instead of directly instantiating BP_Groups_Group
Reported by: | boonebgorges | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 1.6 | Priority: | major |
Severity: | normal | Version: | |
Component: | Groups | Keywords: | has-patch dev-feedback |
Cc: |
Description
See #3758.
BP functions that directly instantiate BP_Groups_Group (for instance, bp_the_topic_object_avatar()) can be wasteful when run many times on a single load. Not to mention that we have no support for persistent caches for objects that, for the most part, are quite static over time.
The attached patch is a first pass at cache support. It does the following:
- Adds support for the WP cache to groups_get_group()
- Swaps out most existing instantiations of BP_Groups_Group with groups_get_group()
- Adds a bit of cache-busting logic to methods of BP_Groups_Group, especially for those using object cache plugins.
In my testing, this patch can shave up to 50 queries off of a single page load!
Thoughts or feedback?
Attachments (1)
Change History (2)
Note: See
TracTickets for help on using
tickets.
(In [5431]) Adds WP cache support to groups_get_group() and switches internal instantiations of BP_Groups_Group out for calls to groups_get_group() where possible. Fixes #3770