Yii 将session存入memcache

 
1:先开启memcache扩展。
 
2:修改配置文件 /protected/config/main.php,在components 中添加以下配置:
 
'session' => array(
'class' => 'CCacheHttpSession',
'autoStart' => true,
'cacheID' => 'sessionCache', // we only use the sessionCache to store the session
'cookieMode' => 'only',
'timeout' => 1400,
),
'sessionCache' => array(
'class' => 'system.caching.CMemCache',
'servers' => array(
array( 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 10),

),
),

0 个评论

要回复文章请先登录注册