OPTASY: Drupal Web Development Agency Toronto
(416) 243-2431Drupal SupportRequest A QuoteQuote

Main navigation

  • Home
  • Services
    • Digital Strategy
    • Design
    • Web Development
      • Drupal
      • WordPress
      • Magento
      • Laravel
      • Shopify
      • Sharepoint
      • Contentful
      • Gatsby
      • Next.js
      • Node.js
      • React
      • AngularJS
    • Mobile & App
      • IOS
      • Android
      • Augmented Reality
      • Artificial Intelligence
      • Virtual Reality
    • Maintenance & Support
      • Drupal Maintenance
      • Wordpress Maintenance
    • Staff Augmentation
  • Portfolio
    • Web
    • Mobile
    • Ar
  • About
    • Who we are
    • Values
    • Events
    • Awards
    • News
    • Careers
    • Partners
      • Acquia
      • Google
      • Pantheon
      • Shopify
      • Wordpress
  • Blog
    • Drupal
    • Drupal 8
    • HTML
    • CSS
    • Javascript
    • PHP
    • Microsoft
    • Web Design
    • Design
    • Tips
    • News
  • Contact
(416) 243-2431 Drupal Support Request A QuoteQuote

In light of the recent COVID-19 pandemic - OPTASY would like to offer DRUPAL website support for any Healthcare, Government, Education and Non-Profit Organization(s) with critical crisis communication websites or organizations directly providing relief. Stay Safe and Stay Well.

From Drush Clear Cache to... Rebuilding Cache in Drupal 8: What's the Difference?
Drupal 8

From Drush Clear Cache to... Rebuilding Cache in Drupal 8: What's the Difference?

by RADU SIMILEANU on Mar 02 2018

The Earth is round, a buttered toast will always fall butter-side down and doing clear cache is every Drupal developer's best practice, these are all globally-accepted truths! And speaking of the latter, when you discover that the familiar Drush clear cache technique is no longer universally unique you wonder: why the change?

Why go from clear-cache, to... actually rebuilding cache, starting with Drupal 8?

What's the catch?

This new way to clear Drupal cache must be stemming from a certain limitation that earlier versions of Drupal presented:

Partially completed cache-clearing operations threatening to grow into fatal errors.

And now, let's dig into more details on:

 

  • clear Drupal cache: why & when
  • the 4 methods for clearing your cache in Drupal
  • Drush clear cache vs rebuilding cache: differences, the initiative behind this change, main benefits to expect 

     

So, shall we proceed?

 

Clearing Your Drupal Cache: Why Bother? And When?

First of all, here's the “motivation” that drives Drupal to create a cache in the first place:

Each time a Drupal site has to render a certain web page, it is “forced” to perform specific database queries; and since all these queries have a negative impact on the overall page loading time, Drupal “decides” to store these web pages, once it will have rendered them, in a cache for later (streamlined) reference.

OK, now that we've settled this whole “cause and effect” process, let's see why and when you should clear cache on your Drupal site:

 

  1. when you're troubleshooting problems on your website; clear Drupal cache before you undertake any debugging, since this might just confirm to you that the “alerting issue” was nothing but a bad cache entry
  2. whenever you want Drupal to quickly record all the updates that you will have performed via the UI, all the changes you will have applied to your code
  3. when you're moving your website to a new host
  4. when you're installing a new theme or module on your Drupal site; just another scenario when Drush clear cache should be the very first step to take while you're troubleshooting

     

In a few words: clearing your cache might just be one of the most frequent actions you'll take while working (or simply maintaining) on a Drupal site. 

And in many cases, the one that will “save the day”, without the need to apply other more complex techniques from your “arsenal”.

 

4 Different Methods to Clear Drupal's Cache 

For there are several ways for you to clear your Drupal site's cache. Just go with the one that best suits your work style:

 

1. The Easy Way: Clear the Drupal Cache From the User Interface 

By far the handiest (and some might say “the less-efficient”, too) method to clear Drupal cache is via the UI:

 

  1. just go to Administration>Configuration>Development>Performance 
  2. and hit the “Clear all caches” button

     

It won't be long till Drupal displays the “Caches cleared” message for you! And that's it!

2. Drush Clear Cache (Drupal 7) or Drush Cache-Rebuild (Drupal 8)

And now, the second method in your “arsenal”: the clear Drupal cache command line one!

A two-way method, better said, which depends greatly on the version of Drupal on your website: 7 or 8?

In this respect, here's the “magic command” to use for clearing your Drupal 7's cache:

drush cache-clear all 

or

drush cc all

Whereas in Drupal 8, this is the Drush command for tackling your cache:

drush cache-rebuild

or, alternatively, these 2 aliased commands:

drush rebuild or drush cr

And here I'm sure you can already tell which are the specific steps to take for handling your cache in Drupal 8 using Drush (still the most convenient way to do it):

 

  1. first of all, you open a Terminal window and CD in your Drupal 8 website's root (a step that you can overlook if it's Drush aliases that you're using):
  2. next, your run your “magic formula”, your Drush command (“drush cache-rebuild” or “drush cr”) and wait for it to complete its task before going back to your website
  3. and finally, you just reload the page you were on, in your web browser

     

3. Run the /core/rebuild.php file for Clearing Your Drupal 8 Site's Cache 

Among all the improvements that Drupal 8 “lures” us in with (built-in WYSIWYG, a Twig templating system and so on), there's the /core/rebuild.php file standing out!

And “promising” us to streamline our frequent (and time-consuming) cache tackling tasks that we need to carry out during development:

The Drupal 8 site in question doesn't even have to be working and the whole process doesn't require Drupal Console or Drush either!

How about that?

The one and only requirement (for there still is one) is that your site's configuration supports it. 

And how can you check whether your site's config accepts this functionality? Well, there 2 methods at your disposal:

 

  1. in case you're working locally, just ensure that $settings['rebuild_access'] = TRUE; in your settings.php (settings.local.php)
  2. or run this script in your command line: /core/scripts/rebuild_token_calculator.sh; then just use the results there as query parameters for /core/rebuild.php (https://goo.gl/qTrJ9d)

     

And voila! This “trick” will rebuild all cache without even requiring for the Drupal 8 site itself to be working during the whole process! 

Which makes it the perfect “plan B”, whenever you don't have Drupal Console or Drush installed where you're working!

The only condition is that your websites' configuration supports this functionality!

 

4. In the Database: Truncate all Tables Starting With “cache_”

Spoiler alert: by “truncate” I do mean emptying, not removing!

The fourth method to clear Drupal cache involves clearing all the data from the cache-related tables in your database. Meaning all the tables starting with “cache_”.

For this, you just go over to your phpMyAdmin, select all the cache_* table and then click “Truncate” in the “with selected” drop-down menu placed at the bottom of the page:

TRUNCATE cache_config;

TRUNCATE cache_container;

TRUNCATE cache_data;

TRUNCATE cache_default;

TRUNCATE cache_discovery;

TRUNCATE cache_dynamic_page_cache;

TRUNCATE cache_entity;

TRUNCATE cache_menu;

TRUNCATE cache_render;

TRUNCATE cache_toolbar;

As for the command line, feel free to scan through and then to tap into the valuable info that you'll find here: https://goo.gl/1b4otB here's another practical example:

Let's say it's Sequel Pro — an SQL GUI app — that you're using. For truncating those specific tables, connect to the server, track down your site's database, have those specific “cache_” tables highlighted and just choose “Truncate tables”, from the drop-down menu!

Also, in the above-mentioned “scenario” you could alternatively go to your PhPMyAdmin's SQL command field or MySQL CLI and run the above-mentioned command:

 

From Drush Clear Cache to Cache Rebuilding in Drupal 8: Why the Change?

Here's the challenge that the conventional Drush clear cache (or “drush cc all”) used to make us deal with:

Drupal's using caching intensively and therefore, it implicitely creates lots of inter-dependencies. Only partially flushing this heavy load of caches used to pose some major risks for any website.

This is where the “cache-rebuild” method stepped in, starting with Drupal 8!

It practically rebuilds (re-bootstraps) the whole Drupal site, after making sure that all cache is perfectly cleared. A “check and double check” technique, you may call it, which makes sure that:

 

  1. your site is up and running
  2. all cache gets flawlessly flushed!

     

Drupal 7's so very popular Drush cache command itself gets cleared and replaced with “cache-rebuild” in Drupal 8.

Which (the Drush cache-rebuild command specific to Drupal 8) carries out the following tasks:

 

  1. clearing the APC cache 
  2. bootstrapping Drupal
  3. calling drupal_rebuild() 
  4. removing the Drush cache 

     

4. Wrap-Up

Summing it up now, the essential info to remember is that:

 

  • “clear cache” should be on top of your “best practices” list as a Drupal developer 
  • you have not just 1, but 4 methods to choose from, depending on your work style and context: via the UI, clear cache using Drush, by truncating your “cache_” database tables, by running the /core/rebuild.php file
  • Drupal 8's cache-rebuild is a step forward from the conventional cache-clear practice; it adds a new “re-bootstrapping” operation to the “cache clearing” process!

Share the article

Development

We do Web development

Go to our Web development page!

Visit page!

Do you want a website

or app developed?

 

Get a Free Quote

and let's make it work!

Get a Quote

Recommended Stories

DrupalDrupal 8NewsTips
Drupal 10 New Features and How to Prepare Your Migration

Drupal 10 New Features and How to Prepare Your Migration

  Drupal is a free and open-source content management system that allows you to create websites with a simple interface, but it has many powerful features for more advanced users. Drupal is being used by millions of people worldwide and many businesses and institutions like Harvard, Twitter, or Whole Foods.  The first version of Drupal was released on January 15, 2001, more than twenty years ago.  Drupal 10 is expected to be released in December 2022. It will be a refined version of Drupal 9 and it will include many new features, including: Symfony 6 compatibility. Site owners and module developers will benefit from as much Symfony 6 compatibility as possible and Symfony 4 deprecations in Drupal 9 for Symfony 5 will be resolved. Supported solutions for rebuilding jQuery UI functionality by using either vanilla JavaScript or frameworks like React. jQuery UI components used by Drupal core will be removed. Best practices for deprecating modules. Users will be able to use a proper mechanism for naming, versioning, deprecating wrappers, etc. A 'lifecycle' - property can be used in info.yml files for themes and modules. Better decoupled developer and site builder experiences, especially for menu and URL handling. Introduction of CKEditor 5 with better authoring experience and more modern editing (replacing CKEditor 4). PHP 8.1 compatibility for Drupal 9 and Drupal 10.  Theme Starterkit tools for bespoke theme creation.     How to prepare for Drupal 10 The following are steps that you should take before upgrading your existing sites to Drupal 10. Upgrade all modules on your current site to their latest versions. If you have not already done so, upgrade core to its latest release. You can do this by running drush up --all from within your Drupal root directory. Perform a full backup of your site. This includes database backups as well as files and folders outside of the Drupal installation directory. Update your site's configuration file. The easiest way to do this is to download the Configuration Upgrade Module module and run it against your site. To do this, go toUpdate your themes and modules to the most recent versions available. In particular, update any custom modules or themes you use to their latest releases. Will the upgrade to Drupal 10 be easy? New functionality for Drupal 10 is added to Drupal 9 releases, meaning module developers can start adopting new APIs right away. Old functionality is removed, but backward compatibility is kept. Once we are ready for Drupal 10, we remove deprecated code, breaking backward compatibility, but because developers had a chance to update their modules, the upgrade to Drupal 10 should be easy. More exactly, Drupal 10 is identical with Drupal 9, except for its deprecation list. There shouldn't be any big or unexpected changes. What are the Drupal 10 platform requirements so far? PHP requirements: At least PHP 8.0.2 and PHP 8.1 is recommended.  PHP 8.0 is being dropped after November 2023, but security patches for PHP 8 will continue to be provided by other organizations. Some of Drupal's Composer dependency packages might start dropping support for PHP 8 after November 2023. Database server requirements: Check out the Database server requirements documentation.  Web server requirements:  They are the same as for Drupal 9. If you need additional support for preparing your migration to Drupal 10, our experienced team of Drupal experts can provide step-by-step assistance. Learn more about our Drupal services today!    Photo credit: Unsplash. ... Read more
Raluca Olariu / May 25'2022
DrupalDrupal 8Tips
Acquia Maintenance Services for Drupal Enterprise

Acquia Maintenance Services for Drupal Enterprise

  Acquia Cloud Enterprise is a fully managed cloud service that provides the infrastructure, tools, and services to run your site on the Acquia Platform. Acquia for Drupal Enterprise is an enterprise-ready version of Acquia's award-winning platform for building and running websites with Drupal 8. It includes all of the features you need to build, manage, and scale a modern website. It also comes with preconfigured modules, themes, and other content so you can get started quickly. What makes Acquia the right Drupal hosting provider? Acquia Cloud Platform offers secure and compliant web hosting services built exclusively for Drupal. You can use them to host your site and develop your content using Drupal 8, Drupal 7, or any other version of Drupal. They offer fully managed Drupal hosting, as well as a range of development tools. Their enterprise-grade security features include SSL certificates and access control lists (ACLs). They also provide world-class customer service. The following are some of the key benefits of choosing Acquia: Fully managed hosting - No servers to install, configure, maintain, upgrade, patch, or monitor. All you have to do is deploy Drupal. Focus on innovation - Having a fully managed Drupal hosting solution allows you to create digital experiences that focus on what matters most: the customer. Highly scalable - Acquia’s cloud architecture scales from small sites to large global deployments. Built for performance - Acquia has built its hardware and software solutions to ensure that your site performs at peak levels. Streamline compliance - Compliance requirements such as GDPR, PCI DSS, HIPAA, and more are easily met through Acquia’s robust data protection practices.   Top features of Acquia web hosting for Drupal Drupal 8 support. Acquia supports Drupal 8 out of the box. This means you can start developing and deploying your next great project immediately. Built-in security. Acquia includes strong authentication and firewall controls. Robust developer tools that provide automated testing for development, staging, and production environments.  Real-time monitoring tools (Acquia Insight) that measure and report on application health. Add-ons. Acquia offers hundreds of add-on modules and themes to help you customize and deliver cutting-edge experiences. Best Practices for Acquia Setup & Maintenance  In order to optimize the performance and functionality of your site, we recommend the following best practices when setting up and maintaining your site on Acquia. Set up the environment before starting work. The first step in getting started with Acquia is creating an account and installing Drupal. Once your site is live, it’s important to keep it running smoothly by regularly updating core, contributed modules, and third-party extensions. Use the Acquia Dashboard. The Acquia dashboard provides a single place where you can view all of your settings, including installed modules, configuration options, and user roles. It's also where you can manage users, groups, and ACL permissions. Keep your database clean. As part of regular maintenance, make sure your database tables are properly maintained. For example, if you have many content types or custom fields, consider using the Field Permissions module to prevent orphaned records. Keep your database optimized. If you use the MySQL Query Cache feature, it will be automatically enabled. To ensure optimal performance, disable caching whenever possible. Optimize your codebase. Use the built-in Drush command line tool to perform updates and upgrades to Drupal core and other modules. Optimize your site architecture. Make sure your site has a clear separation between presentation logic and business logic. This helps separate concerns and makes it easier to maintain your site as its complexity grows. Make sure your site has a clean separation between presentation logic and data access logic. This helps separate responsibilities and makes it easier to update your site when new features are added. Test your site thoroughly. Test your site from multiple devices and browsers. You should test on mobile phones, tablets, laptops, and desktop.    FAQs about Drupal hosting How does Acquia compare to other Drupal hosts? Acquia is one of the few companies offering truly integrated Drupal hosting. The brand has combined its expertise in both technology and business management to make it easy for users to launch and grow their online presence. What is the difference between Acquia Hosting and Acquia Cloud Platform? With Acquia Hosting, customers get all the benefits of a full-featured, managed Drupal platform without having to manage servers themselves. With Acquia Cloud Platform, customers get all the advantages of a private cloud infrastructure with the convenience of a shared environment. Both options allow you to build, test, and deploy websites quickly and efficiently. Is there a free trial available for Acquia Hosting? Yes. You can try our services completely risk-free by signing up for a 30-day free trial. After the trial period ends, you will be billed $9.99 per month. Can I host my website using Acquia Hosting if I am not interested in running an enterprise-level site? Absolutely. Acquia Hosting is designed to work well with any type of website. It comes with everything you need to launch your new or existing website, including: A powerful Content Management System (CMS). An intuitive user interface. Easily scalable resources. Advanced security. Access to thousands of premium WordPress themes and plugins. Support for multiple languages and currencies   To learn more about Acquia Drupal, check out this page.          Photo credit: Unsplash.... Read more
Raluca Olariu / Apr 29'2022
DrupalDrupal 8Tips
How to Find the Best Drupal Developer for Your Needs

How to Find the Best Drupal Developer for Your Needs

  Building a robust Drupal development project that supports your business objectives can be challenging and time-consuming. But with the right Drupal partner that has the experience and expertise needed to help you build a website that will meet all of your needs, you will find this process a lot easier. This article talks about the competitive advantages of hiring Drupal developers and how you can find the best fit that meets your Drupal project needs.  The benefits of hiring Drupal developers Hiring a Drupal developer is an investment in your company's success as it provides plenty of competitive benefits that set you apart from the competition. These advantages include: Building highly-personalized Drupal projects that boost your brand awareness and increase sales. Designing and developing custom Drupal features and functionalities that suit your project requirements. Dedicated support for your Drupal project throughout its lifecycle from content migration and system integration to API design and web accessibility. Having access to ongoing updates and continuous maintenance and support. Reduced costs and increased ROI by having a dedicated team working on your project. What are some of the challenges of hiring Drupal developers? Hiring a Drupal developer or a Drupal development team may not always be easy because there are many factors involved when choosing a Drupal developer. Some of these factors include: Finding a good match between your skillset and their technical knowledge. Choosing a Drupal developer who understands your business goals and objectives. Finding a reliable Drupal partner at a price that fits your budget allowance.     How to spot the right Drupal partner for your business requirements There are several things you should consider before hiring a Drupal developer. Here are some tips to help you identify the right Drupal developer for your project: Do your research first and gain a good understanding of what a Drupal developer is and what are their responsibilities.  A Drupal developer has plenty of duties like conducting research and installing Drupal modules that best fit your needs, extending existing modules so their functionality increases, managing how your website looks and works for high-quality user experiences, migrating existing websites and content, architecting  Drupal projects and web infrastructures, etc.   Also, a Drupal developer can have three main roles that you should pay attention to: Drupal Front-End Developer. A front-end developer is responsible for designing and building the interface of your site using HTML, CSS, JavaScript, jQuery, Bootstrap, Foundation or any other framework. This includes elements such as buttons, forms, navigation menus, or tables and also includes how your page looks. Drupal Back-End Developer. A back-end developer is responsible for programming the logic behind your site's functions and processes. This includes writing code that handles database queries, creates pages, manages users, and more. Drupal Theme Developer. A theme developer is responsible for styling the look and feel of the entire website including the layout, colors, fonts, images, and anything else that makes up the overall appearance. They will work with the front-end developer to ensure that everything on the site matches and flows well together.        2. Identify and examine your project needs.  Now that you know in more detail what a Drupal developer does, it's time to understand your project needs and what you require from a developer's services. Key questions to ask at this stage are: Do you need a back-end expert or a full-stack developer? Do you only need Drupal maintenance? Do you need a whole new enterprise-grade Drupal solution? Would you like to hire a freelance developer or a contract-to-hire? Do you just have a rough idea of what you’d like him/them to develop? What type of experience do you want them to have? How much time would you be willing to spend working with them? How many hours per week would you be able to dedicate to the project?       3. Know where to look for talented Drupal developers. Top channels to consider for passive searches: job portals like LinkedIn, Monster, Glassdoor, Indeed online Drupal (or PHP) communities freelance platforms like Upwork, Toptal, Scalable Path Top channels for your active searches: social media Drupal groups local IT communities LinkedIn (when you start analyzing particular profiles on LinkedIn your passive search becomes active) Drupal.org (select the top Drupal profiles there and start evaluating them against your own requirements) developer communities like GitHub, Stack Overflow       4. Ask the right questions. Among the most important questions to ask potential Drupal partners are: How long have you been working with Drupal development solutions? What Drupal experience do you have? Are you familiar with my business model? Can you provide references? What Drupal skills do you possess? What Drupal technologies do you use?       5. Evaluate your potential Drupal partner carefully. Essential things to consider are: How experienced they are in working with different Drupal versions What their technical expertise is / How skilled they are at Drupal module development Their GitHub Profile (how much time they spent on different projects, samples of their written code, details on their contributions) Their involvement with the Drupal community What past clients say about working with them   Optasy's team of experienced Drupal developers is here to help you We are a development company and we are ready to leverage and to "fuel" your project with all that Drupal expertise that we've been gaining as a Drupal firm during these +10 years: whether it's custom module development, Drupal migration, AI implementation, or any type of new feature integration with Drupal that you need us to do. We're web developers, but with a mobile-first approach to our website development projects, in fact: we commit to helping you deliver the message to your users in an intuitive, effective, and nonetheless appealing way, on all devices.  We'll be in for the long run: our Drupal development services include 24/7/365 support & ongoing maintenance, which means much more than just rolling out patches and updates; we'll ensure that your OPTASY solution (be it Drupal, Laravel, WordPress, Magento, React or Angular-based) keeps meeting your goals, that it continues to remain relevant in the context of future technology changes. From structure planning, to Drupal website development, all the way to maintenance and long-term support, we've got your back; stay assured: full-cycle projects are our specialty as a Drupal 8 agency. As a development company in Toronto we have the experience and the expertise to handle your most specific requirements:   back-end development: we design and develop the custom features and functionalities that suit your project requirements front-end development: from custom themes to user-friendly Uis, to user experience design, to designing responsive layouts content migration system integration API design and development web accessibility  website maintenance: pass over the maintenance burden on our shoulders; we provide ongoing updates and continuous maintenance and support   For more information on how our talented Drupal experts can help you build a robust project for your web development needs, contact us.    Photo credit: Unsplash.... Read more
Raluca Olariu / Jan 21'2022

Browse cities

×

Toronto

WordPress Development Services in Toronto
iOS App Development Services in Toronto
Drupal Development Services in Toronto
Magento Development Services in Toronto
Laravel Development Services in Toronto

Montreal

WordPress Development Services in Montreal
iOS App Development Services in Montreal
Laravel Development Services in Montreal
Drupal Development Services in Montreal
Magento Development Services in Montreal

Vancouver

Magento Development Services in Vancouver
iOS App Development Services in Vancouver
Drupal Development Services in Vancouver
WordPress Development Services in Vancouver
Laravel Development Services in Vancouver

New York

WordPress Development Services in New York
Laravel Development Services in New York
iOS App Development Services in New York
Drupal Development Services in New York
Magento Development Services in New York

Need a new Project?

Dare us to shape and boost your idea(s)!

Start a Project

(416) 243-2431

Contact

(416) 243-2431

contact@optasy.com

Toronto Downtown

First Canadian Place,
100 King St. W. Suite 5700, Toronto

Toronto West

2275 Upper Middle
Rd. E, Suite 101
Toronto

New York

1177 Avenue of the
Americas, 5th Floor,
New York

Newsletter

Get the latest OPTASY news, tips and how-to’s on the go, right in your inbox!
OPTASY
clutch
Pantheon Premier Partner
  • Drupal 8
  • Services
  • Contact Us
  • Partners

  • Drupal
  • Google
  • Magento
  • Shopify
  • Wordpress
Facebook
Twitter
LinkedIn
Drupal
  • Careers
  • Cities
  • Support

© 2022 All Rights Reserved. Built with Drupal