Welcome Guest, Not a member yet? Register   Sign In
Codeigniter - cache only part of the view
#6

(12-14-2015, 03:58 AM)Martin7483 Wrote: Have you seen or tried this?

http://www.codeigniter.com/user_guide/li...ching.html

You can use this to cache anything you want of an x amount of time.

Depending on your server you will need to choose a driver. The library does check if a driver is available when using the Cache interface. When directly using a cache driver you will need to check manually.
To play it save you can just always use the file driver.

How to use:
PHP Code:
// Load APC cache driver or fallback to file when APC not available
$this->load->driver('cache', array('adapter' => 'apc''backup' => 'file'));

// Get from / Save to cache
if ( ! $foo $this->cache->get('foo')) {
 
   // Cache 'foo' invalid or not set
 
   $foo 'foobarbaz!';
 
   
    
// Save into the cache for 5 minutes
 
   $this->cache->save('foo'$foo300);
}

echo 
$foo

It is that easy.

Thanks, I will look this function
Reply


Messages In This Thread
RE: Codeigniter - cache only part of the view - by henry_miaomiao - 12-14-2015, 09:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB