1

Does Craft have a built-in Controller/action for clearing the cache? We have auto-deployment set to a server and would be useful to set up a POST-receive hook to force the cache to clear when deployments are made.

  • Which caches are you wanting to clear? Template caches? General data cache (craft->cache)? Asset caches? All of the above? – Brad Bell Aug 18 '16 at 17:25
  • Yes, template caches primarily although asset might be useful in case assets are being pushed up (thought we generally tend to keep these out of our repos) – Cole Henley Aug 19 '16 at 14:57
2

You'd need to write a super-simple plugin that exposes a controller's action URL your deploy hook could hit. That action would basically just mimic what the ClearCachesTool does for clearing the various caches in Craft.

E.g. Template caches, Asset Transform Index caches, Asset Index caches, general data caches, etc.

| improve this answer | |

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.