Home > Cache

Recently I wrote an article where I explained how to clear page cache entries in Drupal when content is commented on. This time I want to clear entries in the cache_page database table when the following conditions apply:

  1. A new node is created, set to published and promoted to the front page.
  2. A published node which is promoted to the front page is deleted.
  3. A published node which is promoted to the front page is unpublished.
  4. A node which is promoted to the front page is unpublished.
  5. A published node is updated.

Using Drupal's cache can greatly reduce server load, especially if you have lots of non-logged in visitors and many database queries have to executed before a page is displayed. When caching is turned on the HTML output of a page is stored in the cache_page table, so one query is enough to retrieve the HTML output for display instead of hundreds of queries on pages with many blocks, links, etc.

For logged in users pages are not retrieved from the cache but are newly generated each time they request a page. If logged in users post a comment for example they see it immediately after they hit the submit button, wheres non-logged users have to wait until the minimum cache lifetime of the page has expired.

Syndicate content