Opened 11 years ago
Closed 11 years ago
#5434 closed enhancement (fixed)
Improvements to object caching in bp-activity
Reported by: | r-a-y | Owned by: | |
---|---|---|---|
Milestone: | 2.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Activity | Keywords: | |
Cc: |
Description
Similar to #5407, the activity component uses object caching in some places, but it's incomplete and in some cases appears to be incorrect.
This is a general ticket for commits that address the issue for the 2.0 cycle.
Change History (11)
#4
@
11 years ago
Hey boonebgorges, thanks for your work on this. I think it might still need a bit of refining though. I'm trying out the trunk version (as of 5pm EST on 3/4) and I'm still having activity comments being cached improperly. When I post a new activity comment BuddyPress is still not deleting the cached object for the activity.
This occurs both on parent activities that are childless and those which already have child comments. I've verified the bug using both Memcached object cache and various object caching methods in W3TC.
I'll see if I can figure out where the issue is, but you've had more of an eye on this ticket than myself. Just wanted to give you a heads up that I'm still experiencing failure to invalidate activity comment caching.
#5
@
11 years ago
Thanks, aaclayton. Steps to reproduce (or ideally a unit test demonstrating the problem) would be great. We'll continue to work on this ticket leading up to release.
#6
@
11 years ago
I'll try to keep digging, but I'm 100% sure it's a caching related issue. When I retrieve activity comments from wp_cache_get( $activity_id, 'bp_activity_comments' )
in the get_activity_comments function it is pulling a cached set of comments which does not include new comment submissions. If I replace this line with $comments = false;
to bypass caching the issue is resolved.
I verified this on some of the default WordPress themes for my installation, so it's not a theme-specific issue.
The problem seems to be happening in the bp_activity_new_comment() function. I've looked at the source and wp_cache_delete( $parent_id, 'bp_activity_comments' );
should be invalidating that cached entry, but for some reason it is not. If I precede that line with a wp_cache_flush()
for some heavyhanded testing it also fixes the problem.
I'm not sure why the wp_cache_delete in line 1244 does not invalidate the cache...but for some reason (at least on my installation) it is not.
#9
@
11 years ago
aaclayton - I had a closer look, and there were some odd issues in the way that comment invalidation was happening. (It goes back to the fact that the way our comments are stored is itself kinda odd. Oh well.) My tests are passing now, but that only leaves me about 80% confident, because it could be that the tests are incorrect :) Could you please let me know what you find?
#10
@
11 years ago
Excellent, I'll try to make some time to test this later tonight, tomorrow at the latest! Thanks very much for looking into this Boone.
#11
@
11 years ago
- Resolution set to fixed
- Status changed from new to closed
Nearly all of the places where it is convenient and relevant to use persistent caching in bp-activity have been covered at this point. I'm going to mark this ticket fixed. For specific issues beyond those fixed above, let's open new tickets.
In 7997: