Cache Utility module provides an ability to view status and flush various caches in three ways:
- Web browser user interface
- Curl commands
- Drush commands
The following caches are supported:
- PHP OPCache
- PHP APCu extension cache
- Database cache_* tables
- Database cachetags table
- Clear Drupal cache via Curl
Other features
- The module may also be configured to flush any of the above caches along with Drupal’s cache flush.
- An optional sub-module adds links for flushing above caches under the "Drupal icon > Flush all Caches" via the contributed Admin Toolbar Extras module.
Benefits
- The Curl commands provide convenience of flushing various caches externally from the webserver. A single long secret code may be set to manage cache flushing on multiple sites.
- PHP OPCache, and APCu caches can be flushed without server restarts or adding obfuscated php files to the webserver.
- Enables flushing of PHP OPCache via drush which is normally not possible as drush executes using PHP-CLI and not the PHP used by webserver.
- Provides an ability to truncate cachetags database table which is not managed by Drupal core and in certain cases can have unlimited growth which drastically increases database size that may start to affect performance. See Drupal core issue # 3097393
- Provides an ability to truncate cache_* database tables.
Known issue
Truncating cache_* table for sqlite database does not work, due to unresolved Drupal core issue # 2949229
Configuration and Usage report Screenshot
Drush and Curl Commands
Documentation for the curl and drush command for each cache type is included on the module's configuration page at Configuration > Development > Cache Utility
Or at this path /admin/config/development/cache_utility
Sample commands
###############################################################################
# PHP OPCache
###############################################################################
Clear OPCache
Drush: drush cu:opcache-clear --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/opcache/clear
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/opcache/clear
Get OPCache config
Drush: drush cu:opcache-config --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/opcache/config
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/opcache/config
Get OPCache status
Drush: drush cu:opcache-status --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/opcache/status
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/opcache/status
###############################################################################
# PHP APCu cache
###############################################################################
Clear APCu
Drush: drush cu:apcu-clear --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/apcu/clear
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/apcu/clear
Get APCu config
Drush: drush cu:apcu-config --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/apcu/config
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/apcu/config
Get APCu status
Drush: drush cu:apcu-status --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/apcu/status
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/apcu/status
###############################################################################
# Database Cachetags table
###############################################################################
# View the status of database cachetags table
Drush: drush cu:cachetags-status --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/cachetags/status
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/cachetags/status
# Truncate database cachetags table
Drush: drush cu:cachetags-truncate --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/cachetags/clear
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/cachetags/clear
###############################################################################
# Database cache_* tables
###############################################################################
# View the status of database cache_* tables
Drush: drush cu:cachetables-status --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/drupalcache/status
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/drupalcache/status
# Truncate all database cache_* tables
Drush: drush cu:cachetables-truncate --host https://example.com
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/drupalcachetables/clear
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/drupalcachetables/clear
# Clear Drupal's cache
Drush: drush cr
Curl (site host): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' https://example.com/admin/cache_utility/drupalcache/clear
Curl (localhost): curl -H 'Content-Type: application/json' -H 'CU-ACCESS-KEY: LONG_SECRET_KEY' http://localhost/admin/cache_utility/drupalcache/clear
Supporting organizations:
Conceived and developed the module
Project information
- Project categories: Administration tools, Developer tools, Performance
278 sites report using this module
- Created by toamit on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.

