CodeIgniter Forums
Why query cache do not work? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Why query cache do not work? (/showthread.php?tid=62963)



Why query cache do not work? - StratoKyke - 09-12-2015

"Configured database connection has cache enabled. Aborting."
This is my problem.

I use this guide http://www.codeigniter.com/user_guide/database/caching.html for set the query cache and this is my database.php

Code:
$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
    'dsn'    => '',
    'hostname' => 'localhost',
    'username' => '',
    'password' => '',
    'database' => '',
    'port' => '3306',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => FALSE,
    'cache_on' => TRUE,
    'cachedir' => 'application/cache/site',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => TRUE,
    'compress' => TRUE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => FALSE
);

The cache/site is writable...
I would not know what might depend.


Thanks for your reply Smile


RE: Why query cache do not work? - StratoKyke - 09-13-2015

How I can fix?


RE: Why query cache do not work? - InsiteFX - 09-13-2015

Did you try giving it a username, password and database name?


RE: Why query cache do not work? - mwhitney - 09-14-2015

You can't use the database driver for sessions on a database connection which has the cache enabled. So, you would either need to configure a second database connection with cache enabled to be used by the rest of your application, or selectively enable query caching when you want to use it, using $this->db->cache_on() / $this->db->cache_off().


RE: Why query cache do not work? - StratoKyke - 09-14-2015

(09-13-2015, 02:11 PM)InsiteFX Wrote: Did you try giving it a username, password and database name?

Obviously, the data have been removed ahah

(09-14-2015, 09:21 AM)mwhitney Wrote: You can't use the database driver for sessions on a database connection which has the cache enabled. So, you would either need to configure a second database connection with cache enabled to be used by the rest of your application, or selectively enable query caching when you want to use it, using $this->db->cache_on() / $this->db->cache_off().

Thanks for the reply Wink  I'll try to use cache_on and cache_off Wink