[Yii Framework] Share the session with memcache in Yii
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
[Yii Framework] Share the session with memcache in Yii的更多相关文章
- Yii Framework 漏洞整理
一 Yii Framework 2.0.9 - Cross Site ScriptingPublished # Exploit Title: Yii Framework 2.0.9 - Cross S ...
- Yii framework 应用总结小窍门(转)
1. Yii Framework] 如何获取当前controller的名称? 下面语句就可以获取当前控制器的名称了! Yii::app()->controller->id 2. yii 如 ...
- Yii框架(Yii Framework)部署
一.下载Yii 在部署yii框架之前首先要搭建好php环境,这里就不说搭建环境的问题了(这里已经部署好wampserver了),环境搭建好后,到yii官方网站下载yii framework:http: ...
- 拓展Yii Framework(易框架)
1.拓展yii 此文针对Yii1.1.15而写,请注意甄别你的Yii Framework 版本. 拓展yii是开发期间常见的代码处理方式.例如,你写一个新的controller(业务控制器),你通过继 ...
- 将Session写入Memcache
通过session_set_save_handler()方法自定义Session写入Memcache <?php class MemSession{ private static $handle ...
- YII Framework学习教程-YII的异常处理
异常无处不在,作为程序员,活着就是为了创造这些异常,然后修复这些异常而存在的.YII框架封装了PHP的异常,让异常处理起来更简单. 使用 YII处理错误和异常的配置方法: 你可以在入口文件中定义YII ...
- Yii Framework 开发教程Zii组件-Tabs示例
有关Yii Tab类: http://www.yiichina.com/api/CTabView http://www.yiichina.com/api/CJuiTabs http://blog.cs ...
- YII Framework学习教程-YII的Model-开发规范-路径别名-命名空间
到这里,大概的YII开发已经基本可以,但是下面要将的所有课程,学完之后可以让你更爱YII.下面的教程是讲的MVC的M,model.数据,业务,代码的集中地区.所以开始之前,学学开发规范-路径别名-命名 ...
- session 存到memcache里
web服务器的php session都给memcached ,这样你不管分发器把 ip连接分给哪个web服务器都不会有问题了,配置方法很简单,就在php的配置文件内 增加一条语句就可以了,不过前提你需 ...
随机推荐
- SAP MM 模块常用的数据表
SAP MM模块常用数据表: Table Table Class Application Class Data Class Description EBAN TRANSP ME Transactio ...
- ThreadLocal用法详解和原理(转)
本文转自https://www.cnblogs.com/coshaho/p/5127135.html 感谢作者 一.用法 ThreadLocal用于保存某个线程共享变量:对于同一个static Thr ...
- druid+spring配置
web.xml配置 <!-- Druid,监控数据库,以及WEB访问连接信息 --> <!-- 配置好后访问 http://ip:port/projectName/druid/ind ...
- 判断UISrollview的滑动方向
很常用的一个功能,就记录下来了. -(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { historyY = scrollVi ...
- boost.asio包装类st_asio_wrapper开发教程(转)
一:什么是st_asio_wrapper它是一个c/s网络编程框架,基于对boost.asio的包装(最低在boost-1.49.0上调试过),目的是快速的构建一个c/s系统: 二:st_asio_w ...
- fiddler抓取手机上https数据配置和失败的解决办法
1. 设置fiddler,Tools-Options... 抓取https的话,勾选红框中的内容 2. fiddler默认监听端口8888 3. 查看本机IP 4. 打开手机 设置-无线局域 ...
- 对自助提卡系统EDLM的一次代码审计
前言 并非有意愿要审计该站,前面的走的黑盒没有过于精彩部分就不在贴上了,对于此系统站你们懂的,多说无益,这套程序是开源的,像这种自助提卡系统相信大家已经不在陌生了,很多违法网站通过这种平台方式提卡密的 ...
- python利用os和getopt实现删除指定文件
工作中经常遇到要删除某些目录下的特定文件 例如删除xxx目录下的所有test开头文件或者.pyc结尾的文件 如果手动删除的话,很麻烦,写个程序自动删除 只需要运行的时候输入路径和文件名即可,不输入文件 ...
- unity lightmap
indirect light /shadow /ao light probe for dynamic 或者细小琐碎的物体 ========================== unity2018.3 ...
- shader cycles静态分析
mali Mali Offline Compiler https://developer.arm.com/products/software-development-tools/graphics-de ...