Re: [SMARTY-DEV] Making Smarty's cache HTTP header aware
| From: | Dave Mittner | Date: | Thu, 08 Nov 2007 19:39:44 +0000 |
| Subject: | Re: [SMARTY-DEV] Making Smarty's cache HTTP header aware | ||
| References: | 1 2 3 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-3062@lists.php.net to get a copy of this message | ||
I agree with the notion that the headers are as much a part of the response as the HTML, itself.
However; is it the entire response that Smarty is caching or just the HTML of the response-to-be?
By placing these headers in the cached content, you're making that choice for the programmer. I do think allowing this would be useful, but it should be an optional behavior. Maybe a new Smarty method called "cacheHeaders()" or some such?
- Dave (Rikaelus)
----- Original Message ----- From: "Luke Baker" <lukebaker@gmail.com>
To: <smarty-dev@lists.php.net>
Sent: Thursday, November 08, 2007 12:26 PM
Subject: Re: [SMARTY-DEV] Making Smarty's cache HTTP header aware
On Nov 8, 2007 2:06 PM, boots <jayboots@yahoo.com> wrote: [snip]That said, Luke, can you give more detail on why this is important? Thanks!Sure, I'd be happy to. The particular case that I ran into had to do with enabling client-side caching using the Cache-Control HTTP header. In my PHP code, I used something like the following: header("Cache-Control: max-age=21600, public"); That header call was in PHP code that only gets run when the smarty cache does not already exist. Therefore, when there is no cached file for this request, that header() gets called along with additional PHP code. However, any subsequent requests will be served from the Smarty cache, which returns only the content that I had sent previously, but not the headers. Without my patch, Smarty simply caches the content of the HTTP response. In most cases this is sufficient. However, the HTTP headers _and_ the content are what define an HTTP response, not just the content. My patch adds caching of the HTTP headers used in the response alongside the content. Thanks, Luke Baker -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php