Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 4 years ago

#8462 closed enhancement (fixed)

bp_core_clear_cache should be filterable

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

Description

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)

or

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
5 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
5 years ago

  • Component CorePerformance
  • Keywords needs-patch added
  • Milestone Awaiting ReviewUp Next
  • Owner set to espellcaste
  • Status newaccepted

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
5 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
5 years ago

  • Milestone Up Next11.0.0

#5 @imath
4 years ago

  • Milestone 11.0.0Up Next

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

#6 @shawfactor
4 years ago

Guys
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
4 years 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
4 years 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.


4 years ago
#9

  • Keywords has-patch added; needs-patch removed

#10 @espellcaste
4 years 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
4 years ago

  • Milestone Up Next12.0.0

#12 @espellcaste
4 years ago

  • Resolutionfixed
  • Status acceptedclosed

In 13398:

Make the bp_core_clear_cache function pluggable.

Closes https://github.com/buddypress/buddypress/pull/50
Fixes #8462

Note: See TracTickets for help on using tickets.