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

  • 相关阅读:
    Vue模板
    一个人的旅行
    o2o家庭助手demo
    学习html5 app项目开发
    我最近的一段时间技术总结
    我最近的工作、生活状态
    swift学习初步(四)-- 函数
    swift学习初步(三)--控制流操作
    swift学习(二)--基本运算符、字符串、集合操作
    Swift学习初步(一)
  • 原文地址:https://www.cnblogs.com/Alight/p/3543759.html
Copyright © 2011-2022 走看看