Hi,
I want to use database as session data storage (CDbHttpSession)
,
And I used this article too: slow-db-session-table
So I created YiiSession
table in my db with this script:
CREATE TABLE `YiiSession` (
`id` char(32) NOT NULL,
`expire` int(11) unsigned DEFAULT NULL,
`data` varchar(4096) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `expire_idx` (`expire`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
And after that, I changed the `main` config file like:
'session' => [
'class' => 'CDbHttpSession',
'connectionID' => 'db',
'sessionTableName' => 'YiiSession',
'timeout' => 3600 * 24 * 30,
'autoStart' => false,
'autoCreateSessionTable' => false
],
But there are some issues,
1- When I add anything to my session first time it’s not set, and after second time it works.
2- My session doesn’t unset.
unset(Yii::app()->session['hcart']);
After unsetting my session, I print the session value and it’s NULL
,but after refreshing page it’s still have the old value.
*Another thing is, after 2 more calling the method which changes the session value, it’s store the latest value of session.
What is the problem, Can anyone help me?