banner



How To Clear Cloudflare Cache

Plugin Support qtwrk

(@qtwrk)

Hi,

Unfortunately LSCWP does no have command line or cron-job for this

you need to manually to call Cloudflare API

https://api.cloudflare.com/#zone-purge-all-files

Best regards,

Great info, but I am afraid is over my head to enable that by myself.
Thank for your answer.

Alain

Plugin Support qtwrk

(@qtwrk)

Hi,

It's not hard to do so

there is an example code

            curl -X POST "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/purge_cache" \      -H "X-Auth-Email: user@example.com" \      -H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \      -H "Content-Type: application/json" \      --data '{"purge_everything":true}'          

you just need to create a system cron job for it

CF support should help you to get the API and zone ID

Best regards,

Well, I know how to get the API and Zone iD, I don't know were I enter the curl code.

Maybe another way of getting what I need is clearing the CF cache with every post update. I thought of using a cron because most post updates happens every day at the same time.
Is it possible to do that? to sync the LSCache purge with CF cache?

Alain

Plugin Support qtwrk

(@qtwrk)

Hi,

No , LSCWP is not that deeply integrated with CF

if you want to sync purge with CF cache , then you will probably need a PHP'er to do some custom work.

but for purge all cron will be much easier

e.g.

create a shell script , let's say script.sh

with code line this

            #!/bin/bash  curl -X POST "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/purge_cache" \      -H "X-Auth-Email: user@example.com" \      -H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \      -H "Content-Type: application/json" \      --data '{"purge_everything":true}'          

save it to your system , e.g. /home/user/scritp.sh

then create a cron job with whatever time frame you want to call that script

e.g.

0 0 * * * bash /home/user/script.sh

this case , run that script at every day 00:00

I hope this can give you some ideas and hint to how to do this.

Best regards,

Ok, I understand. I will try it…

Thanks a lot!

@qtwrk Thank you si much!
I enabled it in 2 sites that have timed publications, it is working amazingly.

Any hint to synchronise it with post updates?

How To Clear Cloudflare Cache

Source: https://wordpress.org/support/topic/clear-cloudflare-cache/

Posted by: coolidgetherintord.blogspot.com

0 Response to "How To Clear Cloudflare Cache"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel