[buddypress-trac] [BuddyPress Trac] #5414: Object cache all item counts associated with the adminbar
buddypress-trac
noreply at wordpress.org
Thu Mar 6 20:46:01 UTC 2014
#5414: Object cache all item counts associated with the adminbar
-------------------------+------------------
Reporter: r-a-y | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 2.0
Component: Core | Version:
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------
Comment (by boonebgorges):
Generally I would say to hardcode it with the justification "let's not
make it any more complicated than it has to be". But in the case of cache
invalidation, I do think it's helpful to have the items centrally located.
When the time comes to debug problems with it (and the time will come!),
it'll be easier to have it in a single place. So, where possible, let's go
with the `add_action()` technique.
That said, if you feel really strongly about it, go ahead and hardcode it.
My preference here is very very slight. I'll just be sure to call you
first when the bug reports roll in and it's time to write unit tests :)
One suggestion (and this is something that could use improvement
throughout). The callbacks end up effectively being wrappers for the
`wp_cache_delete()` call. If we're going to have the wrapper in virtue of
using the callback technique, we may as well use that wrapper elsewhere.
So, keep `bp_groups_clear_invite_count_for_user()` as is, and then use it
in the other two functions. (This'll make it easier if we want to make
cache groups dynamic at some point in the future.)
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5414#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list