Drush commands to enable/disable performance and cache related options in Drupal 7
The script presented in this post adds two new drush commands: cache-enable and cache-disable which gives us a handy way to disable / enable performance and cache related configuration parameters and options. These parameters can be found in the admin/config/development/performance section of a Drupal 7 installation.
The cache-enable actually performs all the following actions:
The cache-enable actually performs all the following actions:
- Enables the "Cache pages for anonymous users" option
- Enables the "Cache blocks" option
- Sets the "Minimum cache lifetime" option to the required value. Defaults to 1 minute
- Sets the "Expiration of cached pages" option to the required value. Defaults to 1 hour
- Enables the "Aggregate and compress CSS files" option
- Enables the "Aggregate JavaScript files" option
- Finally clears all caches (same as pressing the "Clear All Caches" button)