zoukankan      html  css  js  c++  java
  • [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

  • 相关阅读:
    SQL server使用
    NCC 事务
    springboot学习
    容器
    x86汇编
    git之.gitignore文件用途
    Linux系统安装之U盘引导
    使用异步I/O大大提高应用程序的性能
    Python3.5 用 pip 安装lxml时出现 “Unable to find vcvarsall.bat ”?(转载)
    python之正则表达式
  • 原文地址:https://www.cnblogs.com/Alight/p/3543759.html
Copyright © 2011-2022 走看看