When data in cache invalidates?

Here is an interesting statistics on how the cache is used nowadays:

  • 55% of resources don’t specify a max-age value
  • 46% of the resources without any max-age remained unchanged over a 2 week period
  • some of the most popular resources on the Web are only cacheable for an hour or two
  • 40-60% of daily users to your site don’t have your resources in their cache
  • 30% of users have a full cache
  • for users with a full cache, the median time to fill their cache is 4 hours of active browsing

There are a number of reasons why browser could make a conditional request for item that is already in the cache:

  • The cached item is no longer fresh according to Cache-Control or Expires
  • The cached item was delivered with a VARY header
  • The containing page was navigated to via META REFRESH
  • JavaScript in the page called reload on the location object, passing TRUE for bReloadSource
  • The request was for a cross-host HTTPS resource on browser startup
  • The user refreshed the page