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, 2016 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) Aug 19, 2016 at 14:57

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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