Caching in Drupal6

The Basics
Caches are used to improve the performance of your Drupal site. Rather than extracting the same data over and over again every time a page is loaded, caching stores frequently accessed and relatively static data
in a convenient place and format.

Caching has a drawback in that it can lead to “stale” data. This means that the website outputs old data or content from the cache even though newer stuff exists somewhere else. This problem can be particularly troublesome for developers who can get confused as to why changes they expect to see happen arent. Hopefully, by reading this document, you’ll have a more pleasant and less confusing Drupal experience.

What gets cached, where it gets cached, and how There are two different ways Drupal stores cached data:

1) Using files
Drupal can consolidate all the css files your site delivers on each page load and place them into a fewer number of files. The resulting files are also compressed. This is important for Drupal sites where its not unusual to have a dozen or more stylesheets associated with each page, depending on how many modules are enabled. Having so many stylesheets will increase page load times because the browser has to make several round trips to the server to download all the stylesheet files. By using the css caching feature, you can consolidate these files into fewer larger files and decrease page load time significantly.

Just like style sheets, javascript files can also be consolidated. However, these files are not compressed.

How to turn on stylesheet and javascript file caching
======================================================

First, be sure you have your “Download method” is set to “Public” (set at admin/settings/file-system). You will not be able to use stylesheet and javascript caching when your “Download method” is set to “Private.”

Next, in the navigation menu, select “Administer -> Site Configuration -> Performance” (admin/settings/performance) and scroll down to the “Bandwidth optimizations” fieldset and check off “Enabled” for both CSS files and Javascript files.

Note that turning on stylesheet and javascript caching can interfere with theme development and should only be enabled in a production environment.