4

im working in an acquia cloud environment and currently im clearing the varnish cache via the web interface. is there a drush command to clear varnish cache while using an acquia environment.

  • Is there something about the acquia environment that prevents vp (Varnish Purge) and/or vpa (Varnish Purge All) from working? – Adam Balsam Dec 17 '13 at 21:02
  • actually that command does not exists – Patoshi パトシ Dec 18 '13 at 15:27
  • hmmm. This commit and its associated issue seem to indicate otherwise. Maybe they didn't make it in to 7.x? I find that unlikely though. – Adam Balsam Dec 18 '13 at 15:57
6

With Acquia Cloud API v1 Drush commands

On Acquia Could API v1 the command is ac-domain-purge. Here is a snippet from the drush help available from the Acquia box.

$ drush help ac-domain-purge

Purge a domain from the Varnish cache.

Arguments:
 domain              Domain name. 

Options:
 --username          Acquia Cloud API username                                                                                                                  
 --password          Acquia Cloud API password                                                                                                                  
 --acapi-conf-path   Acquia Cloud API config files location. If not specified config will be loaded from $HOME/.drush                                           
 --caller            Acquia Cloud API caller name. Default is the current username.                                                                             
 --endpoint          Acquia Cloud API endpoint URL.                                                                                                             
 --cainfo            Path to a file containing the SSL certificates needed to verify the ac-api-endpoint.                                                       
 --format            Format to output the object. Use "print_r" for print_r, "export" for var_export, and "json" for JSON. If not provided, the output is printed in a human-readable format.

Additionally, if you want to do this programmatically without drush, Acquia have an API endpoint for clearing the varnish cache.

Note that the drush commands only work with Acquia Cloud API version 1, which is EOL in 2020.

With Acquia Cloud API v2 requests

Acquia Cloud API v2 is json-api based, and the following API v1 to v2 migration document explains the URL request homologue that replaces each v1 drush command. In this case:

The V1 drush API command ac-domain-purge becomes one of either:

  • POST /environments/{environmentId}/domains/actions/clear-varnish

    To clear the Varnish cache for all domains used in an environment (eg both the internal appname.prod.acquia-sites.com domain, as well as your site's public domain.

  • POST /environments/{environmentId}/domains/{domain}/actions/clear-varnish

    To clear the Varnish cache for a single specific domain.

See the Acquia Cloud API v2 documentation reference for additional information.

  • how do you clear cache and varnish together? right now i have to clear the cache first and then again for varnish. – Patoshi パトシ Jan 26 '17 at 16:46
  • Just some note: this isn't shown when in a drupalroot. But works from home directory. – icasimpan Sep 3 '17 at 2:11
  • Note that these drush commands only work with Acquia Cloud API version 1, which is EOL in 2020. Acquia Cloud API v2 is json-api based, and there is a migration document that explains the v2 API command homologue for the v1 drush command here: docs.acquia.com/acquia-cloud/develop/api/migrate – JamesWilson Jul 5 at 15:50
2

There is also a module for that called appropriately "Acquia Purge". Works perfectly. Details from project page:

The Acquia Purge module allows Drupal sites hosted on Acquia Cloud to automatically purge (wipe) pages from their Varnish powered load balancers, as soon as content actually changed. The higher Drupal's "expiration of cached pages"-setting (TTL) is configured the more your site will be served directly off your load balancers. This effectively increases the efficiency of your site and lowers hardware costs, leaving more resources for back-end traffic. In most scenarios the module offers a full turn-key experience without requiring any technical configuration.

I know this doesn't answer the actual question, but its a really easy way to purge varnish cache on acquia cloud using the rules and cache expiration module as dependencies.

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.