CodeIgniter Forums
DB can't cached in CI 1.7.2 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: DB can't cached in CI 1.7.2 (/showthread.php?tid=24427)



DB can't cached in CI 1.7.2 - El Forum - 11-09-2009

[eluser]Unknown[/eluser]
Hi all,

I'm using CI 1.7.2 to developing my project, and found the db cache can't work.
following is database config:
$active_group = "default";
$active_record = FALSE;

$db['default']['hostname'] = "192.168.1.15";
$db['default']['username'] = "mydb";
$db['default']['password'] = "mysql";
$db['default']['database'] = "db_jp";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "dbcache";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
NOTE: "dbcache" folder in system, and it attribute is 777.
and in model I use $this->db->cache_on(); but it didn't work. in database DB_Cache.php file I found that "$path = $this->db->cachedir;" it is relative path, so I modified to absolute path add this sentence: "if ($path{0} !== '/') $path = BASEPATH . $path;" in it.and it is worked fine.