Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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.

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 itMy prefered language is PHP. Thanks.

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

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.

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

![]() |
![]() |
![]() |

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