Blog Banner Image

How to Clear Cache on a Drupal CMS with a Keyboard Shortcut?

Loading a Drupal page requires several database queries which can slow down websites with a lot of traffic. To ensure these pages are loaded faster, Drupal stores web pages in a cache. Developers must clear or rebuild caches when making changes in the code and ensuring faster loading of the website. Clearing caches can also be useful when installing new modules or themes and as the first step in troubleshooting.

Cache clearing can be made easy by using keyboard shortcuts. However, in Drupal, there is no such keyboard shortcut available. Users should use a terminal or cache clear configuration link for cache clearing.

Challenges with the Current CMS Systems

There were two common ways to clear Drupal's cache before we developed this module: via UI or with Drush.

Clearing the Cache with UI

  1. Go to the Performance Administrative Page

Navigate to Configuration > Performance (admin/config/development/performance).

Drupal CMS

  2. Click the button label: Clear all Caches.

Drupal CMS 2 Cache

After clicking clear all caches button, the CMS should display the following message "Caches cleared."

Clearing the cache with Drush

To clear all caches, use the cache-rebuild command: drush cache-rebuild. This will empty all caches and rebuild the data required for Drupal to execute the page request. Alternatively, you can use alias commands drush cr or drush rebuild.

  1. Open a terminal window and cd to your Drupal site root
  2. Run the command 'drush cache-rebuild' or 'drush cr' for short
  3. Reload the page you were working on

Cache Clear Made Easy

Our easy-to-install Key Cache Clear module will provide a hotkey (Keyboard shortcut) to do this simple task. Whenever a user wants to clear the cache they only need to press Alt+C anywhere in the CMS. Pressing this command will automatically clear your cache without any delay.

Key Cache Clear and its Benefits

  • Provides permission configuration and allows administrator to access and make changes to other roles
  • Ensures faster than the traditional Drupal core clear cache function
  • Provides a keyboard shortcut which is convenient and easy to use