What is caching?
Drupal is a program for building websites. Each time someone visits, Drupal collects text and pictures and builds the page. That takes time. Caching means Drupal keeps a ready-made copy of the page. The next visitor gets the copy. It is like writing down an answer so you do not need to work it out again.
Steps
- Log in to your Drupal site as an administrator.
- Click Configuration in the top bar.
- Under Development, click Performance.
- In the Caching area, find Browser and proxy cache maximum age. This tells browsers and other helpers how long they may keep a copy. Choose a time, such as 15 minutes or 1 hour, from the list.
- Look for the section Bandwidth optimization. Tick Aggregate CSS files. CSS files hold the design of your site. Aggregating means joining many small files into one.
- Tick Aggregate JavaScript files. JavaScript files hold small programs that run in the browser. They are joined into one too.
- Click Save configuration.
Pages for visitors who are not logged in are cached by the Internal Page Cache module. If it is off, go to Extend, find Internal Page Cache and tick it. Then click Install. Also turn on Internal Dynamic Page Cache in the same list.
Clear the cache
After you edit your site, you may still see old content. This is because of caching. To refresh it, return to the Performance page. Click Clear all caches.
Test it
- Open your site in a private browser window.
- Reload the page a few times.
- It should feel quicker after the first load.
Quick recap
- Caching saves ready copies of pages.
- Go to Configuration, Development, Performance.
- Set a cache time and tick the two aggregate boxes.
- Save, then use Clear all caches when you change things.