codeigniter database cache configuration
Caching is enabled in three steps:
1) Create a writable directory on your server where the cache files can be stored.
2) Set the path to your cache folder in your application/config/database.php file.For Example :
$db['default']['hostname'] = 'XXXXX';$db['default']['username'] = 'XXXXX';$db['default']['password'] = 'XXXXX';$db['default']['database'] = 'XXXXX';$db['default']['dbdriver'] = 'mysql';$db['default']['dbprefix'] = 'XXX';$db['default']['pconnect'] = TRUE;$db['default']['db_debug'] = TRUE;$db['default']['cache_on'] = TRUE;$db['default']['cachedir'] = 'application/cache';$db['default']['char_set'] = 'utf8';$db['default']['dbcollat'] = 'utf8_general_ci';$db['default']['swap_pre'] = '';$db['default']['autoinit'] = TRUE;$db['default']['stricton'] = FALSE;
3) Enable the caching feature, either globally by setting the preference in your application/config/database.php file, or Manually enables/disables caching as described below.
// Turn caching on $this->db->cache_on(); // Turn caching off for this one query $this->db->cache_off();
Also, make sure your directory is writable (if you are on Mac or Linux)
sudo chmod 777 -R application/cache
I hope it will work for you.
I have to modify the db_cache class as follows
vi +146 /var/www/html/sys/database/DB_cache.php
//ekariz
if(!is_readable($filepath)){ return FALSE;}