Jump to content
Awoo.

About "clearing your cache"


bmn

Recommended Posts

Summary: Go to the offending page in your browser, and press Ctrl+F5.

If there's something weird in your neighborhood, you might get the nod to "clear your cache". Now, clearing your cache is the holy grail of troubleshooting. It will fix any problem you have, have ever had, or ever will have. It's that good.

Not really.

About the cache

So what is this cache thing all about? Well, imagine if, every time you visited a page on a site, your browser downloaded everything. Say you're in The Picture Thread, refreshing every so often to see if there's a new post. Every time you load that page, you have to download a few megabytes of images and other stuff. Suffice to say, if you had a download cap, it'd be gone pretty quickly.

This is where the browser cache comes in. The cache is basically a folder on your computer where all the images, stylesheets etc in a page get stored. When you load up a webpage, the browser and the website collaborate to try to make you download as little as possible, and take the rest straight from the cache.

There are two main ways that the server and browser use to do this. One is that, on first download, the server sends the file (response code "200 OK"), and tells the browser when the file was last updated (e.g. when you uploaded your avatar). Then, on later page loads, the browser says "plz send me this file, but not if it hasn't been updated since [time]". If the file hasn't been updated, the server sends back response code "304 Not Modified" and the browser happily goes to the cache.

The second way is quicker (and it makes the server in particular very happy ^^). On first download, the server sends the file and tells the browser that it should use the cache for a certain amount of time (here, it's 10 days). Thus, on later page loads, the browser doesn't even bother checking for a new file, it just goes straight to the cache. This is quicker, but it means that if the file does change, you'll still see the old one. Onos!

When someone tells you to clear your cache, it's this problem - out of date files - that they want you to fix. But how to actually do it?

Refresh behaviour

Browsers behave in one of three ways when it comes to the cache, depending on the method you use to load the page.

First, let's load up a page for the first time so we can see what's happening.

cache1.png

200s everywhere, cuz this is the first page load.

Now, if we do some browsing around, then come back later by clicking a link...

cache2.png

This time we've only loaded the actual page - the rest has come from the cache. This makes the server (and the browser, to be fair) happy ^^

If, however, we click the Refresh button, or press F5...

cache3.png

The browser in this case has asked the server for an update on all the images, and has used the cache since none of it has changed.

Now, there's actually a second type of refresh - it clears the cache for everything on that page. In Internet Explorer it's Ctrl+Refresh; in Firefox it's Shift+Refresh. The keyboard shortcut for both is Ctrl+F5. Let's try it.

cache1.png

There we go, everything's been downloaded anew from the server.

You can also clear the cache manually through the browser's menus, but this will clear every site. The regular refresh isn't foolproof, so the best way to clear the cache for a page that's not working is to use Ctrl+F5.

DNS cache?

DNS caching is something completely different, and is handled by both the operating system and your ISP. In a nutshell, DNS (Domain Name System) tells your browser where to go when you type in sonicstadium.org, but if the site moves to another server, or something along those lines, the DNS can also become out of date and leave you stranded on the old server.

Unfortunately, there's no easy way of sorting this out, other than waiting. You can clear your OS' cache through the command window or terminal.

Windows: ipconfig /flushdns

Mac OS X: lookupd -flushcache or dscacheutil -flushcache

Linux: /etc/rc.d/init.d/nscd restart

For your ISP, you could try contacting them and requesting that they refresh the DNS for a particular domain, but I doubt you'll have any luck.

The other method is to use another DNS server such as OpenDNS, which will let you refresh whenever you like. You will have to clear your OS' cache after setting this up.

Cookies?

"Cookies" are sets of data that are stored on your computer for the purpose of using them in later page loads or sessions. A couple of examples on this forum are your login details for automatically logging you in, and which topics you've read recently. They always consist of two parts; a key such as "username", and the value for that key, e.g. "bmn".

Out-of-date cookies, or cookies that are badly handled, can cause problems as an out-of-date cache can, though it's not very common. If you need to clear them, though, you can do it on this forum with the "Remove My Cookies" option near the bottom of the page, or for all sites with the appropriate option in your browser.

  • Thumbs Up 1
Link to comment
Share on other sites

  • 6 months later...

PROTIP for Chrome users; you can clear your entire Cache in a flash if you hold Ctrl+Shift+Del.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

You must read and accept our Terms of Use and Privacy Policy to continue using this website. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.