|
Hello:
Are there examples on how to use Zend_Cache together with the MVC pattern? The documentation (and also this mailing list after several hours of searching) provide only examples for old-style procedural PHP applications (basically using Zend_Cache as a stand-alone package), but nothing about how to combine Zend_Cache with Controllers/Actions/Views/etc. I do not have any 'echo' statements in my code; everything is sent to the browser through $frontController->dispatch();... I would like to use cache within certain specific Actions from certain specific Controllers. For example: class IndexController extends Zend_Controller_Action { public function indexAction() { if($cache->start('mycache')) { $this->view->title = 'Cached' . time(); } else { $this->view->title = 'Not Cached' . time(); } } } Do I make sense or am I just not getting something on how the Cache should work? If anybody could give me some pointers, I really appreciate it. Thanks for your help! Cheers, Antonio |
|
I think this could be done with a plugin, you can check inside you
module which module/controller/action is requested and then just act as needed. JARUZ wrote: > Hello: > > Are there examples on how to use Zend_Cache together with the MVC pattern? > The documentation (and also this mailing list after several hours of > searching) provide only examples for old-style procedural PHP applications > (basically using Zend_Cache as a stand-alone package), but nothing about how > to combine Zend_Cache with Controllers/Actions/Views/etc. > > I do not have any 'echo' statements in my code; everything is sent to the > browser through $frontController->dispatch();... I would like to use cache > within certain specific Actions from certain specific Controllers. > > For example: > > class IndexController extends Zend_Controller_Action > { > public function indexAction() > { > if($cache->start('mycache')) { > $this->view->title = 'Cached' . time(); > } > else { > $this->view->title = 'Not Cached' . time(); > } > } > } > > Do I make sense or am I just not getting something on how the Cache should > work? If anybody could give me some pointers, I really appreciate it. > > Thanks for your help! > > Cheers, > > > Antonio > |
|
In reply to this post by JARUZ
> Are there examples on how to use Zend_Cache together with the MVC pattern?
> The documentation (and also this mailing list after several hours of > searching) provide only examples for old-style procedural PHP applications > (basically using Zend_Cache as a stand-alone package), but nothing about how > to combine Zend_Cache with Controllers/Actions/Views/etc. > I do not have any 'echo' statements in my code; everything is sent to the > browser through $frontController->dispatch();... I would like to use cache > within certain specific Actions from certain specific Controllers. have a look at the last example of this page : http://framework.zend.com/manual/en/zend.cache.frontends.html#zend.cache.frontends.page Regards, -- Fabien MARTY [hidden email] |
|
> have a look at the last example of this page :
> http://framework.zend.com/manual/en/zend.cache.frontends.html#zend.cache.frontends.page Hi Fabien: I have looked at the examples on that page... there are no examples regarding caching within a Controller while using the MVC pattern. I.e. I have no 'echo' statements anywhere... it is all sent to the browser at the dispatch(); ... so as far I can understand none of the examples on that page can be applied if I need to cache certain bits & pieces of my application (not whole pages), right? Greetings, Antonio |
| Powered by Nabble | Edit this page |
