-- Jonathan Maron <[email protected]> wrote
(on Thursday, 30 August 2012, 01:14 PM +0200):
> Hello Lode and others
> 
> > I think the idea of the FrontEnd Cacher is great.
> > However it's implementation as in ZF1 fails on quite a few things.
> 
> I agree. However, I have always managed to get it to do what I wanted
> in the past.
> 
> > I think ZF2 is quite minimal as of now.
> > I'm pretty sure a lot will be expanded in the (near) future
> 
> Therefore, if I read your e-mail correctly, at the moment, there is no
> alternative to Zend_Cache_Frontend_Page.
> 
> What is the recommended way in ZF2 to avoid generating the entire page
> on every request? In most of the web applications that I develop, many
> sections are relatively static i.e. they change infrequently, at which
> time, the cache can be purged (thanks to the tagging functionality).
> 
> Even in these static sections, I, however, also need the session available.
> 
> Using Zend_Cache_Frontend_Page, I could init the session, read and
> write data to and from the session in the old Bootstrap.php, but then
> return cached HTML.
> 
> In the case that a section of the application is dynamic, I could call:
> 
> $this->getInvokeArg('bootstrap')->getResource('pageCache')->cancel()
> 
> in a controller to selectively turn off page caching (useful for forms etc.)
> 
> (How) can I do this in ZF2?

You want to look at cache patterns:

    
http://packages.zendframework.com/docs/latest/manual/en/modules/zend.cache.pattern.html

For what you've described, you likely want either the "output" cache
pattern or the "capture" cache pattern; both have examples on that page.

You'd then tie these into application listeners -- likely the bootstrap
and/or finish events -- to accomplish the work.

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to