Welcome Guest, Not a member yet? Register   Sign In
output cache problem with mobile/desktop view.
#2

[eluser]rana[/eluser]
so, as you have to check the agent for each request, you must not cache the output directly. Yes, after you call "$this->output->cache($time)" , it will server the same data instead of entering the controller code execution. So, this is what I will recommend : get the view data returned to a variable. cache it as object cache, and serve from cache. Here is a pseudocode what I would do:

Code:
$template = "";
if($this->agent->is_mobile()){
    $tempate = "my_view";
  }else{
     $tempate = "my_view_mobile";
  }

if ( ! $cache_data = $this->cache->get($template))
{
     $view_result =   $this->parser->('my_view_mobile', $data, true);
     $this->cache->save($template, $view_result, $time);
     $cache_data = $view_result;
}
print($cache_data);


Messages In This Thread
output cache problem with mobile/desktop view. - by El Forum - 05-27-2013, 01:27 PM
output cache problem with mobile/desktop view. - by El Forum - 05-28-2013, 03:34 AM
output cache problem with mobile/desktop view. - by El Forum - 05-28-2013, 07:13 AM
output cache problem with mobile/desktop view. - by El Forum - 05-28-2013, 09:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB