Wayne State Web Team

Wayne State University Web Team Blog

Too much cache

While posting the university closure announcement on wayne.edu (opens new window) this morning I ran into an issue. When visiting the page it wasn't pulling the updated content. My browser was using a cached version of the page it pulled yesterday.

# Cache for fast access

Digging a little deeper I found the problem. We were setting a base expiration time to one week.

ExpiresDefault "access plus 1 week"

This was great for most files but when it comes to HTML and CSS a week if too long for the general public to see it. No one would think to manually refresh a page just because they suspect their version is from cache.

It looks like this problem only effected the homepage and all other sites have correct default expires.

# Access plus 3600 seconds

I made a change today for HTML and CSS files to only cache for one hour. Someone visiting the site and bouncing between pages will still see quick response times. But returning visitors each day will pull a new page and style sheet each hour.

ExpiresByType text/html "access plus 3600 seconds" ExpiresByType text/css "access plus 3600 seconds"

This should eleviate users from not seeing emergency or critical information when needed. Over the next week we will be testing and tweaking this setting, maybe even getting rid of caching on the homepage all together based on what we find.

Our goal is to get up to date information to the end users at the appropriate times. If a little performance has to be sacrificed to make that happen we will.