Re: A question aboout Cache_HTTP_Request

From: Date: Wed, 27 Aug 2003 19:15:56 +0000
Subject: Re: A question aboout Cache_HTTP_Request
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-20674@lists.php.net to get a copy of this message
Stefan Neufeind wrote:
I had a closer look at Cache_HTTP_Request today - and it seems be to quite what I've been looking for :-)
Ditto! It looks very nice.
I need to fetch data that are released via an official server 4 times a year - so each 3 months. I don't know the exact dates though. And as far as I know all cache-time are relative to the first execution of a Cache_HTTP_Request, right?
The Payment_Exchange package that I just proposed has the same problem: 2 of the XML feeds it uses hardly ever change. It could go years without an update. They're quite long, too, so it would be nice not to ever have to download them again. If the server sends Last-Modified headers (I think that might be an HTTP/1.1-only thing), then you could make it check on specific intervals after the Last-Modified time. If you know roughly when it will be released, say 3 months from 2003-08-30, it would be really cool to have it cache for 2.5 months, then start checking every day as it approaches 3 months.
b) How about an option "re-validate"? If the content of the file has not been modified since a certain date there is no need to download it again.
You could do a conditional GET. The cache would send headers asking if the content is still the same (same ETag and Last-Modified headers returned by server), and if not, it would download the file. The cache would have to remember the ETag and the Last-Modified headers (which could be the write time of the cache file). I don't know if Cache stores this information already, but it definitely should. Alexey Borzov said in the HTTP_Status discussion that HTTP_Request is quite capable of sending conditional GETs. Maybe he can help figure out how to impliment this. -- Marshall Roch

« previous php.pear.dev (#20674) next »