Community & Support

Drupal caching problems for anonymous users

I'm trying to understand/modify Drupal's caching and session handling for a client site.

The site is essentially a blog. On the frontpage I have a view that lists the latest blog entries. I have Drupal's built-in caching enabled in "normal" mode (Drupal 5.x). I have cron running every hour. When anonymous users visit the site, they do not see the latest posts unless they refresh their browser. Once they refresh, the new content is displayed correctly. This leads me to think that something in the HTTP headers is telling the browser to just deliver the page from the browser cache. So, I used Firebug to view the HTTP headers...

********************
For logged in users:
********************

"Cache-control" is set to:

store, no-cache, must-revalidate, post-check=0, pre-check=0

Expiration is set to:

Sun, 19 Nov 1978 05:00:00 GMT

Since the expiration is in the past, I presume that the browser knows to use the fresh content. Therefore logged in users see the latest content.

**********************
For anonymous users:
**********************

"Cache-control" is set to:

max-age=1209600

Expiration is set to:

Thu, 18 Feb 2010 02:46:12 GMT

The expiration date is two weeks into the future. I assume that since the expiration is two weeks in the future, the browser deduces that it should retrieve the page from its cache. Therefore the new content is not loaded into the browser.

I would like to somehow have anonymous users see the latest content (e.g. within the last half hour), while still using Drupal's built-in page caching. I thought that I should look through Drupal's cache settings to gain further understanding. From what I can tell, there are two places where caching settings are set: the .hatccess file in the site root and the settings.php file.

***************
.htaccess file
***************
This file has a "ExpiresDefault" setting that is set to A1209600 by default (two weeks).

**************
settings.php
**************
There are several settings here:

session.cache_expire = 200000
session.cookie_lifetime = 200000
session.gc_maxlifetime = 200000

This is where things gets hazy for me. I do not understand what each of these variables achieves in practical terms. Can anyone explain to me what each of these parameters does (again in practical terms)? Ideally I would like Drupal to deliver pages from it's cache, but I would like anonymous users to see posts that have been published within the last half hours. Do I need to change one or more of these values? Does cron need to run every half hour?

I don't know if this is related or not, but...at the same time, I would like authenticated users to remain logged in as long as possible without having to reauthenticate.

Thank you!

Comments

=-=

you want to alter .htaccess

settings.php sessions settings are specifically for sessions I'd think.