Re: [PEPr] Comment on HTTP::HTTP_Cache
| From: | Stephan Schmidt | Date: | Wed, 08 Dec 2004 09:55:59 +0000 |
| Subject: | Re: [PEPr] Comment on HTTP::HTTP_Cache | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34903@lists.php.net to get a copy of this message | ||
Hi,
Davey Shafik schrieb:
Seems to me that this package is kinda pointless. From the description of it on your blog, an MD5sum of the output is used to determine the viability of a cached item... If its not done on the output, then how can you tell if its changed? i.e. echo $_GET['name']; will be the same always in PHP code, but not in the output it shows.
This means that the code must always be executed - thus, saving you nothing.For one, it saves me about 10GB of traffic per month on the sites I maintain :) And this means, it saves some users time. There are two ways two use it: 1. You are not having performance problems and only want your users to have faster access to your site. HTTP_Cache will make sure that the same data is not transferred twice a user reloads the page. This can be done with only instantiating the class. 2. If you already have a cache system, that is able to uniquely identify a page by a cache key, you may as well use this unique cache for HTTP_Cache and thus can check, whether the user already has the page content in his browser cache. When generating this cache unique cache key, you normaly compile a list of all external variables (cookie, session, user input, calculated stuff, etc.) and create an md5 sum for this. I have sites where I have thousand copies of the same page in my server-side cache, all of them have slight differences... HTTP_Cache caches data on the client, for serverside caching use Cache or Cache_Lite. Of course you can also easily combine both. Hope this makes it a bit clearer, Stephan