The software that runs your site, on each page request, must perform calculations and retrieve data from the database, in order to compose the page that is sent to the web browser or other application that is accessing the site. These calculations take time, which can mean that your page load time is longer than would be desirable.
There are several ways that page load time can be sped up, including installing software on the server. The system includes the core Internal Page Cache and Dynamic Page Cache modules, which do not require any additional server software; they use a database cache mechanism to speed up your site. The way these modules work is that during page calculations, intermediate results and the final page output are stored in a special database area (known as the cache). Then the next time a compatible request is made, intermediate or final results, as appropriate, can be retrieved and used rather than redoing the entire calculation. In addition, when content or data that affects a particular calculation is updated, the affected cached data is removed from the cache, forcing that part of the calculation to be redone the next time it is needed.
These caching modules normally work reasonably well, and offer at least some speed-up for most sites. However, sometimes the page cache can have problems, such as:
- Corrupted data in the cache, leading to garbled or incorrect page output
- Old data remaining in the cache too long, leading to outdated page output
- Insufficient caching, leading to slow page loads
Independent of whether the two page cache modules are installed on your site, the software that your site runs will still cache the output of many internal calculations. The core systems that cache data include:
- The theme system caches information in the database cache about which template files are used to render various types of data. If you are developing a new theme and add a new template file, you’ll need to clear this cache to have your theme file recognized.
- The system locates certain low-level PHP functions and classes, such as hook implementations and plugin classes, from your installed modules and stores information about which module has which functionality. If you are developing a new module or adding features to an existing module, you may need to clear this cache to have your new features be recognized.
If you have problems with your site, the first thing to try to fix it is usually to clear the cache. See Section 12.2, “Clearing the Cache” for more information.
Learn about additional caching and performance optimization methods in the Drupal.org community documentation page "Caching to improve performance".
Written by Jennifer Hodgdon.