Answers.Body: <p>You'd need to write a <a href="https://pluginfactory.io/" rel="nofollow">super-simple plugin</a> that exposes a controller's action URL your deploy hook could hit.  That action would basically just mimic what the <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php" rel="nofollow">ClearCachesTool</a> does for clearing the various caches in Craft.</p>
  
  <p>E.g. <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L123" rel="nofollow">Template caches</a>, <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L128" rel="nofollow">Asset Transform Index caches</a>, <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L133" rel="nofollow">Asset Index caches</a>, <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L110" rel="nofollow">general data caches</a>, etc.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-19T17:16:38.837Z
Answers.LastActivityDate: 2016-08-19T17:16:38.837Z
Answers.UserDisplayName: Brad Bell
Body: <p>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.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-18T17:25:59.273Z
Comments.Text: Which caches are you wanting to clear? Template caches? General data cache (`craft->cache`)? Asset caches? All of the above?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-19T14:57:03.133Z
Comments.Text: 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)
Comments.UserDisplayName: Cole Henley
Tags: <plugin-development><cache><controller>
Title: Cache controller/action
ThreadText: # Cache controller/action
  
  (Asked by: username_0 on 2016-08-18)
  
  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.
  
  **Tags:** plugin-development, cache, controller
  
  > **Comments:**
  > **username_1**: Which caches are you wanting to clear? Template caches? General data cache (`craft->cache`)? Asset caches? All of the above?  
  > **username_0**: 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)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-08-19. Score: 2 | Accepted answer
  
  You'd need to write a [super-simple plugin](https://pluginfactory.io/) that exposes a controller's action URL your deploy hook could hit. That action would basically just mimic what the [ClearCachesTool](https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php) does for clearing the various caches in Craft.
  
  E.g. [Template caches](https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L123), [Asset Transform Index caches](https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L128), [Asset Index caches](https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L133), [general data caches](https://github.com/pixelandtonic/Craft-Release/blob/master/app/tools/ClearCachesTool.php#L110), etc.
  
  
  ---
  
  