What happens when the cache entry expires?

Started by sukishan, Aug 23, 2009, 12:08 AM

previous topic - next topic
Go Down

sukishan

If the browser requests an object that's in the browser cache but has expired, the object may still be valid. The browser can then check with the server again to see if the cached entry is still usable. It does this by including an If-Modified-Since header in the request. This is called validating the cache entry. If the cached entry in the browser is still the same, it's unnecessary for the server to resend the unchanged item. If the server finds instead that the content has changed--that is, it's no longer valid--a full response or refreshed page is returned to the browser.

An example sequence of events for a conditional request is shown below:
The browser navigates to a page and makes a HTTP request.
The server returns a successful response with the Cache-Control header and a Last-Modified in the response.
The browser stores the content in the cache.
Time elapses; the browser navigates to the same page again and finds that the content has expired in its cache.
The browser makes a conditional request to the server with an If-Modified-Since cache validator. The same GMT time from the Last-Modified header of the original response (point 2.) is used in the conditional request here.

If the server finds that the content is the same, it responds with a status code 304, indicating that the content hasn't been modified. The browser can then reuse the cached item, saving on download energy.

There is a small overhead when using conditional requests: when using the If-Modified-Since header in the browser's request, and the Cache-Control directive with Last-Modified header in the server's response. But when you compare that to sending the entire response, you're looking at a significant saving in network traffic.
A good beginning makes a good ending

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens Web Designing Chennai | GinGly :: Build your Personal Website | CineBuzz :: Cinema News | My Kids Diary :: Kids Memories Writing :: Book Website @ 349 Rs monthly
Copyright 2005 - 2020 :: IT Acumens :: All Rights Reserved. :: Sitemap
ITAcumens Discussion Forum with 2 lakhs post running for 15 years - Powered by IT Acumens Dedicated Server