Web Caching

What is web caching, and why do I need it?

  • A web cache sits between you and the server you are accessing, saving copies of the responses — like HTML pages, images and files— for itself. Then, if there is another request for the same URL, it can use the response that it has, instead of asking the origin server for it again.


The most important advantages of this are:

  • To reduce latency — because the request is satisfied from the cache (which is closer to the client) instead of the origin server, it takes less time for it to get the representation and display it. This makes the Web seem more responsive.
  • To reduce network traffic — because representations are reused, it reduces the amount of bandwidth used by a client. This saves money if the client is paying for traffic, and keeps their bandwidth requirements lower and more manageable.

 

Kinds of web caches

  • Browser caches

If you examine the preferences dialog of any modern Web browser (like Internet Explorer, Safari or Mozilla), you’ll probably notice a “cache” setting. This lets you set aside a section of your computer’s hard disk to store representations that you’ve seen, just for you. The browser cache works according to fairly simple rules. It will check to make sure that the representations are fresh, usually once a session (that is, the once in the current invocation of the browser).

  • Proxy caches

Web proxy caches work on the same principle, but a much larger scale. Proxies serve hundreds or thousands of users in the same way; large corporations and ISPs often set them up on their firewalls, or as standalone devices (also known as intermediaries).

 

You are able to enable caching for your web browser as follows:

  • Mozilla Firefox

In Firefox this option is enabled by default. There are many ways to disable this option. Th most common examples follow:
Option 1 – Clear the cache for a single page.

  • Install the extension Web Developer Toolbar and use the “Options > Reset page” feature of the extension.

  • You have to click this option every time you want to clear the cache. The page will reload itself when you do that.

Option 2 – Completely disable the cache

  • Right click on your chrome shortcut and choose “Properties”. Modify the “Target” value and add the following at the very end (after the double quote) and restart chrome:
  •   -disk-cache-size=N –media-cache-size=N
  • Here is the complete value that I have for my shortcut:
  •  “C:Documents and SettingsChristian RoyLocal SettingsApplication DataGoogleChromeApplicationchrome.exe” –disk-cache-size=N –media-cache-size=N
  • With this option, you cannot use the cache on any pages unless you change your shortcut and restart chrome.

 

Google Chrome

  • You might be aware of the fact that there is no technique to change Google Chrome’s cache size and location from the browser preferences. However, here is an easy way to achieve this by making a few tweaks to chrome’s installation path settings.
  • For Windows 7, Google Chrome’s cache is located in the following folder: C:Users\%username%AppDataLocalGoogleChromeUser DataDefaultCache
  • If your computer’s hard drive space is fairly low or you have by mistake created a low volume system partition then you might be facing hard times disposing Google Chrome’s web cache. You can even disable disk cache if you want the browsing data to be stored on your ram and disposed of as soon as you exit Google Chrome.

Here are the steps that need to be done:
1. Right click the Google Chrome shortcut icon from desktop. If there is no shortcut, create 1one.
2. Switch to the “Properties” tab
3. Here, you will find a “Target” Field. You have to replace the Target text with

C:UsersusernameAppDataLocalGoogleChromeApplicationchrome.exe — disk-cache-dir=”mylocation” –disk-cache-size=cachesize
where mylocation stands for the path of the directory where you want to store the cache, and cachesize stands for the size of the cache you want to keep on your disk (in bytes). Following is an example:

As an example, if you want to store cache on D:Cache and you want the cache size to be 100MB, you can replace the Target text as:
C:UsersusernameAppDataLocalGoogleChromeApplicationchrome.exe –disk-cache-dir=”d:cache” –disk-cache-size=104857600
4. If you want a negligible amount of cache to be stored on your hard disk and remaining to be consumed on ram itself, you can put the cache size to be ‘1’ which will consume all of the browsing data on ram only.

5. Now, press the Apply button and then the OK button to save your settings.

Note: The above settings will only work if you run Google Chrome by clicking the shortcut from your desktop. If a third party application launches Google Chrome or you open it from the installation directory, the older cache settings will work.

In such situations, you may apply the following settings in Windows registry to permanently change Google Chrome’s cache location and size:

1. Open the registry editor by typing in regedit in the run dialog box.
2. Now locate the registry key HKEY_CLASSES_ROOTChromeHTMLshellopencommand
3. Now, edit this key just like you edited the Target Field in Google Chrome’s shortcut.
4. However, you have to edit the key just the way like you did with Target Field, you will have to place – “%1? at the end.

 

Internet Explorer

  • Internet Explorer consists of 4 levels of cache.
  • To change these settings, pull down the Tools menu, then Internet Options.
  • In the Temporary Internet Files, click Settings.

a.    Each time you visit the page: When you visit a Web page, Internet Explorer verifies whether a copy of this page is cached. If the copy is in the cache and matches the page on the Web, Internet Explorer will display the updated version in the cache.
b.    Each time you start Internet Explorer: When you visit a Web page, IE checks the cache for a copy of this page from the current session. If there is no page in the cache from the last session, IE will load the page from the Web.
c.    Automatically: IE saves the pages you visit and counts how many times you visit them.
d.    Never: Pages are always loaded from the cache instead of the internet.

Was this article helpful?

Related Articles