About Browser Caches

What is a cache?

Computers use different kinds of storage. This is because storage media is either slow and cheap or fast and expensive. For example, the media closest to the CPU is the level one (L1) cache, which is right on the chip with the CPU and is extremely expensive. The L1 cache transfers data at several hundred million bytes per second. Then there's the slightly less-expensive level two (L2) cache (about 50 megabytes/second), then main memory (about 10 megabytes/second, then the disk drive (about 1 megabyte/second), and then the network (about 100 kilobytes/second).

A cache (pronounced "cash") takes advantage of a phenomena called "locality of reference". This is computer speak for describing the fact that you tend to use the same small amount of stuff repeatedly, and most of the other stuff much less often. It's like the fact that you tend to drive around town a lot more than you drive around the rest of the country.

When your computer goes to reference a location in the many kinds of storage, it first looks close by to see if it used that location recently. If not, it looks a little further away, and so on. When it finds the data it needs, it stores it close by, in a cache, with the assumption that it will be used again. If no space is left in the cache, it bumps out something old to make room for the new thing.

If your computer finds most things it looks for in a fast nearby cache, then it seems like all of your slow, cheap storage is as fast as that small, expensive cache.

Why does a browser have a cache?

Networks are slow. Modems are even slower. When you go to a web page to download its text and images, it can take a long time using a modem. We know that most web pages don't change much. It would be nice if we didn't have to pull all that data across the network and down through the modem every time we want to view a page.

So each time we read a page, the page and all its graphics and other files are stored nearby, in a cache, in case we go there again in the near future.

Do I need to worry about my browser cache?

Different browsers have different settings for their cache. For example, Netscape allows you to decide whether to use memory (small, fast, expensive) or the disk (big, slow, cheap) to store the cache. It also lets you control how much disk to use before bumping old stuff.

You should select an amount of disk equal to the space taken by all the places you go regularly. If you always seem to be waiting for the network, your cache may be too small. You may not be keeping pages long enough, so that when you revisit them they're no longer on your hard disk for quick access. They're getting bumped by new stuff. It'll be like trying to hold two gallons of water in a one-gallon jug.

I have a lot of available disk space, so I set my cache to 30 megabytes. At this size, it takes a long time before my cache fills and old stuff starts to fall out the other side. However, 5 to 10 megabytes is a reasonable size.

One advantage of having a large cache is that I can view pages when not online. Netscape will fetch pages from the cache if it can't get to the network.

Netscape also lets you decide when it should check the real web pages to see if they've changed. If they've changed, you want to ignore the copy in the cache and replace it with a fresh copy from the network. Checking the age of a page on the network against the copy in your cache takes time, but not as much as downloading the whole page.

On my copy of Netscape, this setting is under Network Preferences, and you can select to check every time the page is viewed, never, and once per session (ie. since Netscape was last started). I use the last option. If you really want to get a fresh copy (because you know the page has changed), you can hit the Reload button to force your browser to go to the network (instead of the cache) for the page.

Do I need to clear my cache?

No! Your cache is helping to make your web session fast. Clearing the cache throws away all the pages you've been to recently, and forces you to wait for them the next time you need to go there. Instead, if you need more disk space for another application, reduce the size of the cache, and let the browser delete the oldest files.


Surfin Ken's Sewing Page

My home page

My pages have been visited 29500 times.

Last updated April 16, 1999 by webmaster@sewingwitch.com