Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Dylan Lopez
Added: Mar 6, 2018 8:53 AM
Views: 18
  1. $this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
  2.  
  3. if ( ! $foo = $this->cache->get('foo'))
  4. {
  5.         echo 'Saving to the cache!<br />';
  6.         $foo = 'foobarbaz!';
  7.  
  8.         // Save into the cache for 5 minutes
  9.         $this->cache->save('foo', $foo, 300);
  10. }
  11.  
  12. echo $foo;