Re: Caching via URL
From: Manuel Lemos (mlemos_at_acm.org)
Date: 03/05/04
- Next message: HamuNaptra: "Re: The lowest PHP/SQL-hosting prices!!!"
- Previous message: Kevin Torr: "Session problems"
- In reply to: Shabam: "Caching via URL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 04 Mar 2004 21:23:03 -0300
On 03/04/2004 04:25 AM, Shabam wrote:
> I need to implement a caching mechanism for my script URLs. Instead of
> www.domain.com/script.cgi?id=1234 , which the browser will obviously not
> cache, I want the URL to be something like www.domain.com/1234 or
> www.domain.com/1234.htm instead. This way the browser will cache the page.
I am afraid there is some misconception here. Client side caching has
nothing to do with the scripts page URL but rather with the headers the
scripts return.
> I have two concerns:
>
> 1) Is this possible without rewriting the url? If so how?
With PHP and Apache yes. You can have a script named browse . Configure
Apache to handle it as PHP script. Then use URLs like browse/1234.html .
There by looking at some of the request variables you can extract the
1234 from de /browse/1234.html REQUEST_URI .
> 2) The result page will be different for different users. Will this cause
> trouble with proxy servers? My goal is only to cache a particular version
> for a particular user so that if he requests the URL again (within X
> minutes) the server doesn't have to process it again.
I am afraid you can't do that with client side caching precisely because
of proxy servers.
You can improve things via server side caching. I use this class that
can produce different caches with distinct timeouts for different types
of users. It stores cached content on files as well timeout values. You
just need to use different cache file names for the different types of
users so it can check the correct cached version.
I use this all the time to cache different page versions for different
groups of users (anononymous, logged in, administrators, authors, etc..).
http://www.phpclasses.org/filecache
-- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html
- Next message: HamuNaptra: "Re: The lowest PHP/SQL-hosting prices!!!"
- Previous message: Kevin Torr: "Session problems"
- In reply to: Shabam: "Caching via URL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|