How does caching work in Drupal?

Drupal caching system allows customized settings to speed up website using different configuration with page caching, block caching and lifetime for cached pages.
Page caching:
  • If enables, page caching will only be used for anonymous users.
  • If you enable page caching, the entire HTML of each page will be stored in the database. This significantly reduces the amount of queries needed.
  • This automatically means that blocks will also get cached, disregarded their own cache settings.
  • If Varnish is configured, this will also enable varnish caching
  • The page cache max-age will be used (see below) for each page.
  • You can check the “X-Drupal-Cache” HTTP header to check if this cache is HIT.
Block caching:
  • If you enable block caching, without enabling page caching, the block cache settings will be used (for anonymous and authenticated).
  • The defaults for most blocks is “don’t cache” because that is the default for blocks who don’t have their cache settings specifically declared.
  • You can use block_cache_alter module to set this for each block.
  • When it’s block created by Views, you can set the cache settings for a block in Views.
Minimum cache lifetime:
  • This is the amount of time before the page cache is cleared.
  • Page caches are cleared on each cron run (system_cron).
  • Be warned: incorrect settings of your cron and this setting might kill your website performance. See also this issue.
Expiration of cached pages:
  • This only applies for external caching mechanisms, for example your browser cache or Varnish.
  • It sets the Cache-Control max-age value in the HTTP-HEADERS.
  • This setting only takes effect when page caching is turned on.

1 comments:

Anonymous
14 January 2014 at 07:22 comment-delete

thank you very much

Reply

Post a Comment

Don't Forget to comment