Erica Zhang wrote:
David,
Thanks a lot for your reply. While, I just want to cache HTTP
responses produced by PHP scripts. Of course, those responses perhaps
include PHP scripts. On the other hand, I know I could do it by use
of PHP itself. I just want to provide a general one. This means no
matter what kind of script or languages used for server development,
for example, ASP, PHP, Java and etc, I could use only one module to
cache those HTTP responses. I thought Apache could handle or filter
HTTP responses or requests. So I want to add modules to handle caching
dynamic HTTP responses problems.
However, based on your suggestion, it seems that I have to developed
separate ones for Java, ASP, PHP. Right ?
If your server is acting as a proxy to another server and it's content
generation, no - which ever platform you want to develop your caching on
will cache. If the local server is generating the response, then the
local application is responsible for either caching or using appropriate
caching headers. If the caching mechanism is understood, just use the
existing "mod_cache" and it's associated extensions (e.g. mod_mem_cache
and mod_disk_cache). Questions regarding those modules would be better
answered on the users' lists rather than here.
But is there some general way to cache responses ?
Consider modifying whatever is generating the response to include the
caching headers - a system has been in place for cache control for
years. If the headers exist, the browsers should only check the
modification times and request the new page if the modification time has
changed.
If your server is acting as a proxy to another content, you only have
two options -
a) modify the content generation server to include the caching headers
b) Force your server to do caching regardless of the headers. This
will have the wonderful effect in which the web browsers won't have
control over getting updated docs - and thereby causing network guru's
to run around like squirrels on caffeine until they realize that a
server in between is responding with data that should be dynamic but
isn't because it's been cached. This is because there will be no
mechanism to determine when the file coming from the generator has been
updated. It's a blind cache, and I would never suggest a blind cache
for the sanity of people using the system.
Joe
--
Joseph Lewis <http://sharktooth.org/>
"Divide the fire, and you will sooner put it out." - Publius Syrus