Re: [SMARTY-DEV] Making Smarty's cache HTTP header aware

[email protected] ("Dave Mittner") Thu, 8 Nov 2007 12:39:44 -0700
Newsgroups php.smarty.dev
Message-ID <071101c8223f$1d71cb20$8a738e44@DaveMLaptop>
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" <[email protected]>
To: <[email protected]>
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 <[email protected]> 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
>
>
>