Fragment Caching and Isset?


I have json base generated a page. I try fragment caching this page. I have a problem. Cache is running but my php base json loader function is running. I want to control json loader


//// Sitecontroller


if(iscache) { // is exist same function

$json = file_get_content("blabla.json");

$infoCentent= CJSON::decode($json, true);


else infoCentent = "";

$this->render(‘info’,array(‘infoCentent’ => $infoCentent));



<?php if($this->beginCache(“content”, array(‘duration’=>300))) { ?>


<?php echo $info; ?>


<?php $this->endCache(); } ?>

your question is not clear what exactly you trying to do


If the content is cached, file_get_content function should not work. How can I do check cache?

you see this line right here


This method will display cached content if it is availabe. If not, it will start caching and would expect a endCache() call to end the cache and save the content into cache.

but why would you wanna check it in the controller


does exactly the same checks if data is in cache, why would you break MVC by doing this?