Skip to:

Opened 3 years ago

Closed 16 months ago

#8462 closed enhancement (fixed)

bp_core_clear_cache should be filterable

Reported by: shawfactor's profile shawfactor Owned by: espellcaste's profile espellcaste
Milestone: 12.0.0 Priority: normal
Severity: normal Version:
Component: Performance Keywords: has-patch


Right now bp_core_clear_cache just calls prune_super_cache( $cache_path, true );

This has two major problems, namely

  1. it is complete overkill (especially on multisite) as this clears the entire wp super cache cache.
  1. This just relies on wp super cache, if the code stays it should be a general solution

There ae two solutions. Either remove the code entirely (probably the best one)


Change the code such you can filter the circumstances in which you want to delete the cache. And maybe change the caching mechanism through a filter.

Change History (12)

#1 @shawfactor
3 years ago

Hello can someone look at this? All that is needed is a simple filter to turn this function off. As the way it clears the cache can be very heavy handed.

#2 @espellcaste
2 years ago

  • Component changed from Core to Performance
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Up Next
  • Owner set to espellcaste
  • Status changed from new to accepted

Let's discuss this further in the next milestone. The solution seems simple but I'd like to better understand the use case and the possible side effects of introducing a new hook.

#3 @shawfactor
2 years ago

Ideally we should get rid of wp super cache support from buddypres entirely (it is plugin territory). But at a minimum the ability to selectively suppress the caching behaviour is needed as buddypres removes all wpsc caches every time something changes in buddypress.

This is complete overkill.

#4 @espellcaste
2 years ago

  • Milestone changed from Up Next to 11.0.0

#5 @imath
18 months ago

  • Milestone changed from 11.0.0 to Up Next

Hi, sorry this ticket is postponed once again. I haven't seen it soon enough 😞. I believe as BuddyPress is used to power ​ there might be a reason why this code is there.

#6 @shawfactor
18 months ago

What I’m requesting would have no conflicts

i just want the code wrapped by a filter so it could be turned off. The default would still be to run it.

This would have zero effect on current users of this code.

#7 @espellcaste
18 months ago

@shawfactor I get it! I personally just want to have a better understanding of what's happening there before introducing this change. :)

#8 @shawfactor
17 months ago

The function clears the entire β€œwp super cache” cache on any new activity. It makes sense to have filter a filter allowing this behaviour to be disabled programmatically

It is very simple and makes so I bit mystified on why there is a delay.

This ticket was mentioned in ​PR #50 on ​buddypress/buddypress by ​renatonascalves.

16 months ago

  • Keywords has-patch added; needs-patch removed

#10 @espellcaste
16 months ago

In the above pull request, I suggest making the bp_core_clear_cache function "hookable". This will allow plugin and theme authors to perform cache purge actions relative to their site/setup without introducing much hassle to BuddyPress itself.

#11 @imath
16 months ago

  • Milestone changed from Up Next to 12.0.0

#12 @espellcaste
16 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 13398:

Make the bp_core_clear_cache function pluggable.

Closes ​
Fixes #8462

Note: See TracTickets for help on using tickets.