pluginkollektiv / cachify

Smart but efficient cache solution for WordPress. Use DB, HDD, APC or Memcached for storing your blog pages. Make WordPress faster!
https://wordpress.org/plugins/cachify/
GNU General Public License v2.0
101 stars 32 forks source link

Adds action triggers to cache flush methods - Allows Cachify flushing to be extended #294

Closed ouun closed 2 months ago

ouun commented 10 months ago

I tried to extend Cachify with hooks to handle additional API requests to an edge cache. However, I ended up with some very hacky solutions as there are no action hooks available at the end of the cache flush/delete logics.

This PR simply adds two action triggers to the two main cache flush methods, which I hope I have identified correctly. It allows for any other callback functions to be added after the entire cache or a single cache item has been deleted.

I really hope you agree with this and that it can be merged with the 2.4.0 release. Redis support and these hooks will make Cachify even more flexible and powerful. Thanks for your great work!

sonarcloud[bot] commented 5 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
3.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

stklcode commented 5 months ago

While being pretty much self-explaining and matching calling method's names, I find the hook names little long.

Maybe something like cachify_flushed_page and cachify_flushed_total? Or simply keep the long names, I only have a weak personal opinion on this one...