XCache driver CodeIgniter

Page content

Here is a missing XCache driver for CodeIgniter Caching Class . All You need to do is to modify /system/libraries/Cache/Cache.php library and add additional Cache driver to drivers list:

protected $valid_drivers = array('cache_apc', 'cache_file', 'cache_memcached', 'cache_dummy', 'cache_xcache');

Then you need to upload Cache_xcache.php file, to this directory: /system/libraries/Cache/drivers/


Load cache drivers as usually:

$this->load->driver('cache', array('adapter' => 'xcache'));

and use as it

$this->cache->save('my_variable', array(0=>'data', 1=>'other data'));


Due to XCache limitations You can’t store objects in cache, but you can serialize them before saving 🙂

Download from github