To handle timeout you need to go outside of PHP. I use nginx to do something
like "add_header Last-Modified $date_gmt" (you can do cache control and Expires
depending on the files too). nginx's main directives are add_header and
expires. It does not support Etags (and probably won't since the developer
doesn't find them worth the trouble :)). With a little more work I can even
pre-compress the static files with gzip and use ngx_http_gzip_static_module to
serve those without impacting the CPU.
Those private methods are probably the same ones (or similar) that I met when
writing my recent blog entries about this proposal. I've added them to the
proposal as a general refactoring point that is a precondition - they are a
pain in the ass to work around and I've been using a funky
bin2hex/pack('H*',...) (insert other validator buster) adapter to work through
them.
Anyone have other thoughts on the idea? I might put the proposal up during
tomorrow for further comment.
Paddy
Pádraic Brady
http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation Irish Representative
________________________________
From: Nico Edtinger <[email protected]>
To: Pádraic Brady <[email protected]>
Cc: Zend Framework General <[email protected]>;
[email protected]
Sent: Monday, January 19, 2009 11:50:56 PM
Subject: [fw-general] Re: [zf-contributors] Static HTML Zend_Cache Backend
Proposal
I was thinking about something similar myself. The problem is not so much
getting a static html cache, because that's already possible, but getting a
predictable filename and an easy way to access the timeout/expiry, without
using PHP. My goal would be using Lighttpd with a very short Lua script to
serve a static version, without having to start the PHP interpreter and setting
the mtime to a future date as expiry. As it was only an idea and I didn't
really had much time I just took a quick look if that would be possible with
Zend_Cache, but found out, that methods I'd need are declared as private.
nico
Pádraic Brady wrote:
> Hi all,
>
> In between writing and actually finishing proposals for a change (Zend_Oauth
> will be ready this weekend!), I've been putting together some fragments of
> code I've been using with Zend_Cache over the months.
>
> At present, Zend_Cache offers the Page Frontend which does a really great
> job, but there are cases where caching to static HTML files is an option and
> I would like to propose such an addition. It's not without it's problems,
> especially since Backend validation seems to be performed by the Frontend
> (Zend_Cache_Core has a few private static methods), but I can muddle on
> through :).
>
> Any comments or ideas are welcome. In the future I may also take a stab at
> looking into integrating cache control closer to our Controllers, Views and
> Models since to be honest, the present DIY system has me writing lots of
> wiring code and managing cache expiry manually in a dozen different ways
> depending on my mood. I like to think adding better integration would
> alleviate some of this pain for others.
>
> Being the writer of mega 4000 word blog posts that I am (think my wrist just
> fell off...), I've written up a barebones prototype as part of another
> fabulous put-you-to-sleep blog post. I'll be posting it over the weekend, but
> if anyone is interested in a quick copy now to see what I'm moaning about,
> just drop me a line.
>
> Best regards,
> Paddy
>
> Pádraic Brady
>
> http://blog.astrumfutura.com
> http://www.survivethedeepend.com
> OpenID Europe Foundation Irish Representative