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
100 stars 31 forks source link

Flush cache via URL / cron job #238

Open Zodiac1978 opened 3 years ago

Zodiac1978 commented 3 years ago

Fastest Cache is providing a smart way to trigger the cache flush via Cron Job: https://www.wpfastestcache.com/features/clear-cache-via-url/

A user is asking if this is possible to implement in Cachify here: https://wordpress.org/support/topic/clear-cache-using-cron-job/

The documentation mentions some action hooks but no specific working code example to do that.

How about adding this feature in this or some other way?

stklcode commented 3 years ago

One can simply add a custom Cron job utilizing the cachify_flush_cache action (no arguments required) action using for example WP Control. Then the cache is flushed periodically in the regular WP cron cycle.

Second option is using WP CLI, if CLI-level is applicable in the desired case. There is a flush action available yet.

Another option is calling the …?_cachify=flush URL behind the admin bar button via Cron. However this required an active session and a Nonce… We might consider migrating this function to an WP API endpoint (there are external auth mechanisms for the API so it can still be secured)

Barnabas2 commented 3 years ago

I utilized WP Control plugin and seems to be working nicely. Maybe the documentation could include this solution.