0

Is there any easy way to create a keyboard hotkey to flush all caches in a Drupal site?, instead of going to Admin menu Drupal icon and click that time and again? Thx.

  • 1
    Look at Drush, or set up your Cron Jobs. You shouldn't need to manually clear the cache so often that it needs a keyboard shortcut. – Beebee Jul 14 '15 at 14:54
  • 1
    Or even better, turn off caching altogether when you're developing. Then turn it back on when you're done. – Beebee Jul 14 '15 at 14:55
2

If you've enabled the search bar component on Admin menu you can search your way to it.

Admin menu's search components

  1. Enable the Search Bar component on the configuration page (/admin/config/administration/admin_menu).
  2. Type "flu.." or enough characters to list only the "Flush all caches" menu item.
  3. Press the tab key to highlight and the enter key to trigger the "Flush all caches" menu item.

Searching through admin menu's items

  • Hello Shawn, I think I did not manage to understand your answer. Could you please rephrase or simplify it for me? Ben. – JohnDoea Jul 16 '15 at 15:24
  • 1
    Sure. I've made some changes and add images to reference what I'm referring to. – Shawn Conn Jul 16 '15 at 16:34
  • One could argue that this is no faster than using the flush caches link admin menu already provides. – rooby Sep 1 '15 at 4:33
2

Devel module also has such feature , you can access that link by enabling module and placing development block somewhere in your access .

Devel has many other facilities for working with drupal .

  • Could you please elaborate on how to create such hotkey with Devel? – JohnDoea Jul 17 '15 at 17:59
  • Just Download and Install Devel module , after enabling that go to Structure -> Blocks and you will find a development Block , this Block contains some facilities like "Clear all caches" menu and ability to run PHP Code Directly in a page . – Alireza Tabatabaeian Jul 17 '15 at 20:00
2

I solved this problem, maybe my solution help somebody:
1. Create node with php mode
2. Insert next code:

<?php
  drupal_flush_all_caches();
  drupal_set_message('cache flushed.');
?>

3. Add button on the toolbar with links to created node. Enjoy!

  • 1
    You could also just replicate the link that is buried in the admin menu in the top level of the admin menu or some other block. – rooby Sep 1 '15 at 4:38
  • Yes it is also possible – user49660 Sep 1 '15 at 4:39
  • This solution requires the PHP module to be enabled, which a large number of site administrators will not do. – rooby Sep 1 '15 at 4:42
  • Yes I am agree with your views, but this is only a solution as a Drupal Developer for the other Developers. – user49660 Sep 1 '15 at 4:56
  • Nice Solution. I've implemented this inside my form, as a validation on a checkbox. Obviously for development only! ;-) – C. de la Fonteijne Aug 22 '16 at 8:58

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.