[Yii Framework] Share the session with memcache in Yii
2014-02-11 02:21
363 查看
When developing distributed applications with Yii, naturally, we will face that we have to
share the session in different machine. So here we will use memcache to do it.
here is the example to store the session with memcache in Yii, in the main.php file:
'cache'=>array(
'class'=>'system.caching.CMemCache',
'servers'=>array(
array(
'host'=>'192.168.1.1',
'port'=>11211,
),
),
),
'sessionCache'=>array(
'class'=>'system.caching.CMemCache',
'servers'=>array(
array(
'host'=>'192.168.1.2',
'port'=>11211,
),
),
),
'session' => array (
'class'=> 'CCacheHttpSession',
'autoStart' => true,
'cacheID' => 'sessionCache', //we only use the sessionCache to store the session
'cookieMode' => 'only',
'timeout' => 1400
),
For the details, pls refer to http://www.yiiframework.com/doc/api/1.1/CCacheHttpSession#cacheID-detail
Have fun with Yii!
转于:http://www.cnblogs.com/davidhhuan/archive/2012/11/22/2781903.html
share the session in different machine. So here we will use memcache to do it.
here is the example to store the session with memcache in Yii, in the main.php file:
'cache'=>array(
'class'=>'system.caching.CMemCache',
'servers'=>array(
array(
'host'=>'192.168.1.1',
'port'=>11211,
),
),
),
'sessionCache'=>array(
'class'=>'system.caching.CMemCache',
'servers'=>array(
array(
'host'=>'192.168.1.2',
'port'=>11211,
),
),
),
'session' => array (
'class'=> 'CCacheHttpSession',
'autoStart' => true,
'cacheID' => 'sessionCache', //we only use the sessionCache to store the session
'cookieMode' => 'only',
'timeout' => 1400
),
For the details, pls refer to http://www.yiiframework.com/doc/api/1.1/CCacheHttpSession#cacheID-detail
Have fun with Yii!
转于:http://www.cnblogs.com/davidhhuan/archive/2012/11/22/2781903.html
相关文章推荐
- Memcache集群安装与配置
- Memcached缓存
- java,缓存,memcached,reids,c,android 技术视频
- linux 下安装memcached
- server_socket_inet in kmemcache 阅读笔记
- PHP中封装MEMCACHE常用方法基于YII框架下
- Redis与Memcached的区别
- Memcache应用场景介绍,说明[zz]
- 缓存之memcache-1
- NGINX + TOMCAT7 + MEMCACHED 实现SESSION 共享
- 在 Azure 网站上使用 Memcached 改进 WordPress
- 在 Azure 网站上使用 Memcached 改进 WordPress
- 在 Azure 网站上使用 Memcached 改进 WordPress
- 在 Azure 网站上使用 Memcached 改进 WordPress
- Java Memcache windows
- memcached的基本命令(安装、卸载、启动、配置相关)
- 将session放到memcache上面
- Memcached 搭建过程
- Memcached 深度分析
- Memcached应用总结