[TYPO3-mvc] Caching framework inside extbase extension

Kevin Ulrich Moschallski km at 3digit.de
Thu Dec 30 18:08:47 CET 2010


Hi Franz,

once again, you made my day. Works gerat. Thanks for your help.

Regards,
Kevin

On 2010-12-30 17:56:43 +0100, Franz Koch said:

> Hey,
> 
>> My next step was to store the result of $this->view->render() instead
>> and push it with $this->result->setContent().
>> 
>> This works fine, my only problem is, that the "normal" view output is
>> also rendered, which gives me some translated error messages from my
>> template that the necessary objects are empty.
> 
> why don't you simply return the rendered/cached view in your controller 
> method? This will also prevent the view to be rendered again.
> 
> if ($this->cacheInstance->has(hash('md5','category'.$demand->getCategory()))) {
>     $content = $this->cacheInstance->get(hash('md5', 
> 'category'.$demand->getCategory()));
> } else {
>     $references = $this->referenceRepository->findDemanded($demand);
>     $this->view->assign('demand', $demand);
>     $this->view->assign('categories', $this->categoryRepository->findAll());
>     $this->view->assign('references', $references);
> 
>     $content = $this->view->render();
> 
>     $this->cacheInstance->set(hash('md5', 
> 'category'.$demand->getCategory()), $content , array('type' => 
> 'references'));
> }
> 
> return $content;




More information about the TYPO3-project-typo3v4mvc mailing list