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

  • 相关阅读:
    双向循环链表
    字符串拷贝
    div样式调整.txt
    解析xml的单个节点值和循环节点消息体
    C++中的string
    正则表达式教程
    一个很好的Qt教程个人主页
    单射、双射与满射
    ISO C++ forbids declaration of * with no type
    一个中学生的个人主页
  • 原文地址:https://www.cnblogs.com/Alight/p/3543759.html
Copyright © 2011-2022 走看看