0

I'm using cloudflare with magento 2 and their magento plugin says that they purge the cache whenever the magento cache is purged so is there a way to set the time when the magento cache is cleared or does it do it all automatically?

I read that the crontab changes the indexes and sends out email but I saw nothing about clearing the cache

0

It might be different when using CloudFlare (I haven't investigated fully) but I assume it'd be the same as using Varnish natively.

When a URL has been detected as invalid a purge request is sent to remove that page from the cache, it is then re-cached when it is requested again. This process is usually done automatically through Varnish/other FPCs so don't see why it would be much different to CloudFlare.

As far as having the cache flushing on a schedule, this can be done fairly simply through the crontab with:

0 0 * * * /usr/bin/php </path/to/magento/install>/bin/magento cache:flush

But I have to note that I don't personally like doing this and only use as a last option. Most of the time the cache should clear automatically through the the FPC purging the pages that are invalidated.

|improve this answer|||||
  • What does the 0 0 * * * mean? – user3610374 Apr 20 '17 at 17:08
  • It's the time that the cron will run the given task - 0 0 * * * translates to every day at midnight/12am/00:00. – Matt Antley Apr 20 '17 at 17:11
  • Thanks and cloudflare said that the only way to have them perform the caching is to have magento clear the cache less often. I'm completely new to this cloudflare stuff so I'm just following their direction – user3610374 Apr 20 '17 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.