最近要搞redis 主从,但yii自带的redis 不支持主从,没办法只好自己写一个了 配置如下:
1、main.php中添加下面一句:
//redis缓存配置 'cache_redis' => include(dirname(__FILE__) . DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'redis.php'),
<?php return array( 'class'=>'ext.zredis.YiiRedisCache', 'keyPrefix' => '', 'hashKey' => false, 'serializer' => false, 'rw_separate'=>false, 'connect'=>'pconnect', 'timeout'=>300, 'servers'=>array( array( 'host'=>'127.0.0.1', 'port'=>6379, 'db'=>0, ), array( 'host'=>'127.0.0.1', 'port'=>6378, 'db'=>0, ), array( 'host'=>'127.0.0.1', 'port'=>6377, 'db'=>0, ), ), );
有要源码请联系327168521@qq.com
原文地址:http://blog.csdn.net/liangpz521/article/details/41285017