views:

51

answers:

3

How long are files usualy kept in a browser's cache? I'm wondering about the general population - how long would I need to wait to be reasonable certain that most people's caches will refetch the file?

+1  A: 

It depends much on person, browser and settings.

Browser usually reserves certain amount of disk space, like 12 MiB, to this task. If user stopped using browser it is indefinitely (i.e. until expiration). If (s)he uses browser heavily it can be 12 minutes or even less.

I believe that it is hard to say 'in general' as I had a website on which 50% entries were from Firefox and 49% from Opera when IE at that point had over 75% of market. If target of your side are users who uses browser heavily it can be very short. On the other hand if your site is only website visited it can be nearly never.

Maciej Piechotka
+1  A: 

Typically files will stay in the cache until space runs out. There is an article that describes some of the defaults for popular browsers: It's Time to Rethink the Default Cache Size of Web Browsers

As Maciej stated, it's also a matter of how much each person browses. Think of the user base that will be visiting your site into consideration, as well as how bandwidth-heavy your site is (if the average user downloads tons of content from your site, chances are they will fill their cache real fast).

If a cache refresh is needed, you can force the page to not cache files.

phaxian
A: 

As the other answers have stated, it depends upon the browser settings. But note that having a file cached doesn't necessarily mean that changes are not fetched from your site. If configured to do so, the browser will send a request to the server, with details about the date of the cache file. The server than then respond with "ok, use your cache - it's the latest version" when there are no changes. This repsonse is small and quickly sent. If the server version has been updated, then the server will respond with the new version.

How often the browser sends a request to the server is browser-specific - they can be configured to check for updates each time, once an hour, once a day, never or anywhere in between. The server can also specify how often the browser should check for updates.

this is just a sketch - it is simplified and incomplete. For the complete details, see W3C - HTTP/1.1 Caching.

mdma