I'm developing a website (with a shopping cart) on top of Codeigniter, and want to use the sess_use_database setting to make it more difficult for users to hack a shopping cart session.
I also want to use database caching to speed up common DB requests (such as 'get categories' as most of the DB content won't change regularly), so I have enabled this setting:
$db['development']['cache_on'] = TRUE;
//where 'development' is my environment
As a result, I am finding that session contents aren't being refreshed, for example on this request:
$this->basket_contents = array_values($this->session->userdata('basket_contents'));
Also, I have tried this:
$this->db->cache_off();
...before the session request, but it doesn't solve the problem (I assume because it isn't a direct DB request).
My session setings are as follows:
$config['sess_cookie_name'] = 'str_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
Can I prevent caching of session-related DB requests? Or prevent certain tables from being cached?
OR is there another (probably obvious) solution I've not thought of?
Thanks in advance.