作者:惠玲琦扬2 | 来源:互联网 | 2014-05-14 09:39
开始->运行->输入cmd,命令行打开memcached.exe,所在文件夹,输入:memcached.exe-dinstall安装输入memcached.exe-dstart启动打开yii配置文件:config/main.php,在components下添加:[html]..."/>
开始->运行->输入cmd,命令行打开memcached.exe,所在文件夹,输入:memcached.exe -d install 安装
输入memcached.exe -d start 启动
打开yii配置文件:config/main.php , 在components 下添加:
[html]
'memcache'=>array(
'class'=>'CMemCache',
'servers'=>array(
array(
'host'=>'127.0.0.1',
'port'=>11211,
'weight'=>60,
),
array(
'host'=>'127.0.0.1',
'port'=>11211,
'weight'=>40,
),
),
),
'memcache'=>array(
'class'=>'CMemCache',
'servers'=>array(
array(
'host'=>'127.0.0.1',
'port'=>11211,
'weight'=>60,
),
array(
'host'=>'127.0.0.1',
'port'=>11211,
'weight'=>40,
),
),
),
使用:
[html]
Yii::app()->memcache->get(id);
Yii::app()->memcache->set(id,value,time);
Yii::app()->memcache->get(id);
Yii::app()->memcache->set(id,value,time);