Computing.Net > Forums > Web Development > Cache Control.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Cache Control.

Reply to Message Icon

Name: mie2com
Date: August 18, 2007 at 08:58:54 Pacific
OS: xp
CPU/Ram: pentium IIII
Product: dell
Comment:

Hi. I've been 'google-ing' around to understand this subject better. Still the most article that I found on the web is far too way hard to understand with deep technical jargons. Does anyone have a good web resource related to for beginners of this subject? Glad if u could help. Thanks in advance.



Sponsored Link
Ads by Google

Response Number 1
Name: mie2com
Date: August 18, 2007 at 09:03:48 Pacific
Reply:

In addition to the above, to make it clear, I would like to know about:

1) How to use it
2) When to use it
3) Which one to use it
4) What to consider before use it

My prefered language is PHP. Thanks.


0

Response Number 2
Name: Michael J (by mjdamato)
Date: August 18, 2007 at 11:28:40 Pacific
Reply:

Cache contol simply dictates how and where content is cached. For example, if you have pages that provide constantly updated stock information you would want to ensure caching is disabled.

Here's an example. User goes to the "apple" stock page and checks the curent price. User then navigates to the "PepsiCola" page to check that stock price. THen the user hits the back button. Normally, the user's browser would show the last displayed page (cached page) instead of getting a fresh copy. In this instance you would want to disable the browser from caching content.

However, in other instances you would want to ensure the browser is caching. For example, if you have a multi-page form. If the user hits the back button to go back to a previous form all of their previously entered data will be lost if not cached.

With PHP you can send a directive to the browser on how it should handle caching for a particular page using the following:

header("Cache-Control: parameter1 [, parameter2]");

Here are the possible parameters:
max-age=seconds - the number of seconds from the time of the request you wish this object to be keep into the cache;
s-maxage=seconds - like max-age but it only applies to proxy;
public - tell to handle the content has cacheable even if it would normally be uncacheable, it is used for example for authenticated pages;
no-cache - force both proxy and browser to validate the document before to provide a cached copy;
must-revalidate - tell the browser to obey to any information you give them about a webpage;
proxy-revalidate - like must-revalidate but applies to proxy;

http://www.badpenguin.org/docs/php-...


Michael J


0

Response Number 3
Name: mie2com
Date: August 18, 2007 at 15:36:55 Pacific
Reply:

Thanks for your reply MichaelJ. It helps me to understand the purpose of 'cached' better. Of all those parameters, correct me if i'm wrong, this is what i understand at the moment:

max-age: after certain amount of time, user browser will get fresh copy of page.

s-maxage : after certain amount of time, proxy will get fresh copy of page.

no cached: both user browser/proxy will forced to get fresh copy of page.

must-revalidate: only user browser will forced to get fresh copy of page

proxy-revalidate: only proxy will forced to get fresh copy of page

What does it mean by "cached by proxy"? How that happen. Can you give example. Thanks again.


0

Response Number 4
Name: Michael J (by mjdamato)
Date: August 18, 2007 at 22:54:00 Pacific
Reply:

All this information is out there for you. No need for me to look it up and regurgitate it for you: http://en.wikipedia.org/wiki/Proxy_...

Michael J


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Cache Control.

Getting no cache to work www.computing.net/answers/webdevel/getting-no-cache-to-work/3513.html

Caching html www.computing.net/answers/webdevel/caching-html/3373.html

POST method not sending content www.computing.net/answers/webdevel/post-method-not-sending-content/1609.html