子分类
  • 无子分类
memcached缓存配置
  • 2014-08-07发布
  • 2014-08-07修改

复制bzf框架库中的缓存配置文件Tun/ConfigDemo/cache.config.php,到网站根目录下的config目录中,修改服务器配置参数,就可使用memcached缓存服务器了。


cache.config.php文件的内容如下:

<?php
return array(
        'cache'=>array(
            'isCrypt' => false,
            'expiration' => '3600',
            
/************memcached***************/
            'storage' => 'memcached',
            'master'=>array(
                            'host' => '127.0.0.1',
                            'port' => '11211',
                    ),
            'blance' =>array(
                    array(
                            'host' => '127.0.0.1',
                            'port' => '11211',
                    ),
                    array(
                            'host' => '127.0.0.1',
                            'port' => '11211',
                    ),
                    
            ),    
            
/************redis****************/
//             'storage' => 'redis',
//             'master'=>array(
//                 'host' => '127.0.0.1',
//                 'port' => '6379',
//             ),
            
/*************filesystem****************/
//             'storage' => 'filesystem',
            'cache_server' => array(
                    'cachedir' => 'data/cache',
            ),
        ),
    );

如果只有一台memcached缓存服务器,需注释掉blance项。


cache类的使用请参考:Cache缓存类(class Cache)