4

I am using Drupal 8, and I am wondering how I can clear more caches than the button in admin/config/development/performance does.

I have had trouble with installing Drush, so I am looking for any alternative solutions.

4 Answers 4

8

Just execute core/rebuild.php.
As the documentation says, it rebuilds the cache even when Drupal doesn't work; it require a token you can generate with scripts/rebuild_token_calculator.sh, so you call it as http://example.com/core/rebuild.php?token=TOKEN_YOU_GET_FROM_THE_SCRIPT.

1
  • 4
    You can avoid the token by temporarily using $settings['rebuild_access'] = TRUE; in your settings.php, too. Just remember to remove it when you are done as it not safe to leave this unprotected on a live site.
    – mpdonadio
    Mar 12, 2016 at 23:10
1

Check out Admin Toolbar for Drupal 8, it emulates all the dev functions from a drop down menu like we had in Drupal 7 from Admin Menu. Be sure to activate "Admin Toolbar Extra Tools" as part of the module.

enter image description here

0
0

That button clears all caches, just like drush would.

The only alternative to that would be to clear the caches directly in the database, which isn't much convenient.

2
  • The callback attached to that button does a lot more than just clear caches tables in the database. The biggest differences are probably the container invalidation and the router rebuild that get triggered.
    – mpdonadio
    Mar 12, 2016 at 21:01
  • Oh, and to be extra clear, that button and drush do the exact same thing and eventually call drupal_flush_all_caches(). It is just that there is more to it than simply truncating the {cache*} tables from the database.
    – mpdonadio
    Mar 12, 2016 at 23:07
0

The methods I've come across for clearing the JavaScript cache in Drupal (either from the Admin UI or from Drush) do not work reliably, which causes a huge amount of frustration when you're using a framework on top of Drupal to create a web application.

The workaround I use is to alter the version number in your module.libraries.yml file, which is at the root of your module folder.

Example:

reporting:
  version: 1.31
  css:
    layout:
      css/jquery.notifyBar.css: {}
      css/tagify.min.css: {}
      css/bootstrap-datepicker.min.css: {}
    theme:
      css/reporting-theme.css: {}
  js:
    js/smsw-utils.js: {}
    js/shim.min.js: {}
    js/xlsx.full.min.js: {}
    js/reporting.js: {}
    js/knockout-min.js: {}
    js/jquery.notifyBar.js: {}
    js/bootstrap-datepicker.min.js: {}
    js/tagify.min.js: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.