http://blog.csdn.net/felio/archive/2006/09/29/1303647.aspx
本文简要介绍一下安装的情况,以及PHP模块memcache使用情况:
提要:
1。安装memcached服务器端
2。安装php对memcache支持模块
3。使用memcache情况,计数器、数据压缩
4。Memcache内存的更新清理(delete flush)
5。内存超量的测试(set)
1。安装memcached服务器端
memcached安装说明(北南南北的站):
http://www.linuxsir.org/main/?q=node/184
注意的是:如果你安装过程中出现错误,请看看是不是有模块没装:
autoconf
zlib (压缩数据用)
2。安装php对memcache支持模块
PHP老家:
http://cn.php.net/manual/zh/ref.memcache.php
(PH<chsdate w:st="on" year="1899" month="12" day="30" islunardate="False" isrocdate="False">P 4.3.3</chsdate> or newer is required to use the memcache extension. 难道,4.3.3都装上了吗?好像没有吧,用4.4.4好像都要另外装的)
3。使用memcache情况,计数器、数据压缩
使用情况一:统计
<shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></path><lock aspectratio="t" v:ext="edit"></lock></shapetype><shape id="_x0000_i1070" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape><?php
<shape id="_x0000_i1071" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>//访问统计
<shape id="_x0000_i1072" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache=newMemcache;
<shape id="_x0000_i1073" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->connect('localhost',11211)ordie("Couldnotconnect");<shape id="_x0000_i1074" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1075" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>if($s=$memcache->get('a')){
<shape id="_x0000_i1076" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$s=$s+1;
<shape id="_x0000_i1077" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->set('a',$s);
<shape id="_x0000_i1078" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1079" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>else
<shape id="_x0000_i1080" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->set('a',1);
<shape id="_x0000_i1081" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'访问结果为:'.$s;
<shape id="_x0000_i1082" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>?>
其实我们可以用increment方法代替上面的做法
<shape id="_x0000_i1083" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape><?php<shape id="_x0000_i1084" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1085" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache=newMemcache;
<shape id="_x0000_i1086" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->connect('localhost',11211)ordie("Couldnotconnect");
<shape id="_x0000_i1087" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1088" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>if($s=$memcache->increment('a',1)){
<shape id="_x0000_i1089" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo$s;
<shape id="_x0000_i1090" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1091" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>else
<shape id="_x0000_i1092" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->set('a',1);
<shape id="_x0000_i1093" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>?>
数据压缩:
<shape id="_x0000_i1094" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape><?php
<shape id="_x0000_i1095" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache=newMemcache;
<shape id="_x0000_i1096" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->connect('localhost',11211)ordie("Couldnotconnect");<shape id="_x0000_i1097" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1098" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$test=(str_repeat('jetwong',100000));
<shape id="_x0000_i1099" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->set('b',($test));
<shape id="_x0000_i1100" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>?>
使用压缩:
<shape id="_x0000_i1101" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape><?php<shape id="_x0000_i1102" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1103" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache=newMemcache;
<shape id="_x0000_i1104" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->connect('localhost',11211)ordie("Couldnotconnect");<shape id="_x0000_i1105" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1106" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$test=(str_repeat('jetwong',100000));
<shape id="_x0000_i1107" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->set('b',($test),MEMCACHE_COMPRESSED);
<shape id="_x0000_i1108" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>?>
使用情况说明:
前台比较 |
目前内存 |
总共读取 |
总共写入 |
压缩前 |
700085 |
700081 |
416 |
压缩后 |
1131 |
1125 |
13 |
可能看到压缩后明显占用内存少了不少
4。Memcache内存的更新清理(delete flush)
<shape id="_x0000_i1109" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape><?php
<shape id="_x0000_i1110" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache=newMemcache;
<shape id="_x0000_i1111" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->connect('localhost',11211)ordie("Couldnotconnect");
<shape id="_x0000_i1112" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1113" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>/*设置值*/
<shape id="_x0000_i1114" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$status=$memcache->getStats();
<shape id="_x0000_i1115" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'设置前内存使用情况'.$status['bytes'].'<br>';
<shape id="_x0000_i1116" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'设置后';
<shape id="_x0000_i1117" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>for($i=0;$i<9;$i++){
<shape id="_x0000_i1118" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->set('b'.$i,rand(1,99));
<shape id="_x0000_i1119" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'<br>'.$i.'->'.$memcache->get('b'.$i);
<shape id="_x0000_i1120" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1121" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1122" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>/*查看设置的值*/
<shape id="_x0000_i1123" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$status=$memcache->getStats();
<shape id="_x0000_i1124" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'delete前内存使用情况'.$status['bytes'].'<br>';
<shape id="_x0000_i1125" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'<br>开始delete';
<shape id="_x0000_i1126" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>for($i=0;$i<9;$i++){
<shape id="_x0000_i1127" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->delete('b'.$i);
<shape id="_x0000_i1128" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'<br>'.$i.'->'.$memcache->get('b'.$i);
<shape id="_x0000_i1129" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1130" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape><shape id="_x0000_i1131" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1132" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>/*查看flush使用的情况*/
<shape id="_x0000_i1133" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$status=$memcache->getStats();
<shape id="_x0000_i1134" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'使用flush前内存使用情况'.$status['bytes'].'<br>';
<shape id="_x0000_i1050" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'使用flush情况:';
<shape id="_x0000_i1051" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>for($i=0;$i<9;$i++){
<shape id="_x0000_i1052" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->set('b'.$i,rand(1,99));
<shape id="_x0000_i1053" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'<br>'.$i.'->'.$memcache->get('b'.$i);
<shape id="_x0000_i1054" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1055" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->flush();
<shape id="_x0000_i1056" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'flush之后:';
<shape id="_x0000_i1057" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>for($i=0;$i<9;$i++){
<shape id="_x0000_i1058" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'<br>'.$i.'->'.$memcache->get('b'.$i);
<shape id="_x0000_i1059" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1060" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$status=$memcache->getStats();
<shape id="_x0000_i1061" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'flush后内存使用情况'.$status['bytes'].'<br>';
<shape id="_x0000_i1062" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>?>
5。内存超量的测试(set)
我们把内存设为2M
./memcached -d -m 2 -p 11211 -u root
<shape id="_x0000_i1063" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape><?php
<shape id="_x0000_i1064" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache=newMemcache;
<shape id="_x0000_i1065" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$memcache->connect('localhost',11211)ordie("Couldnotconnect");
<shape id="_x0000_i1066" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1067" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>//600K左右
<shape id="_x0000_i1068" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$test1=str_repeat('jetlee',100000);
<shape id="_x0000_i1069" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>//600K左右
<shape id="_x0000_i1135" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$test2=str_repeat('jetlee',100000);
<shape id="_x0000_i1136" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>//600K左右
<shape id="_x0000_i1137" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$test3=str_repeat('李连杰',200000);
<shape id="_x0000_i1138" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>//600K左右
<shape id="_x0000_i1139" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$test4=str_repeat('连杰李',100000);
<shape id="_x0000_i1140" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>//200K
<shape id="_x0000_i1141" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$test5=file_get_contents('http://img.pconline.com.cn/images/photoblog/2988177/20068/4/1154688770042_mthumb.JPG');
<shape id="_x0000_i1038" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$test6=file_get_contents('http://img.pconline.com.cn/images/photoblog/1767557/20069/28/1159417108902_mthumb.jpg');
<shape id="_x0000_i1031" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>
<shape id="_x0000_i1032" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>for($i=1;$i<=6;$i++){
<shape id="_x0000_i1033" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$j='test'.$i;
<shape id="_x0000_i1034" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>if($memcache->set($j,$$j)){
<shape id="_x0000_i1035" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo$j.'->设置成功<br>';
<shape id="_x0000_i1036" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$status=$memcache->getStats();
<shape id="_x0000_i1037" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo'内存:'.$status['bytes'].'<br>';
<shape id="_x0000_i1025" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1026" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>else{
<shape id="_x0000_i1027" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>echo$j.'->设置失败<br>';
<shape id="_x0000_i1028" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1029" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1030" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>?>
执行结果:
test1->设置成功
内存:600042
test2->设置成功
内存:1200084
test3->设置失败
test4->设置成功
内存:1200084
test5->设置失败
test6->设置失败
刚好印证我们的计算,不过20万的repeat为什么会失败,不是太了解,,,,,,
总结:
示例:
<shape id="_x0000_i1039" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape><?
<shape id="_x0000_i1040" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>//设置篇
<shape id="_x0000_i1041" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>if($data=$memcache->get('k',$v)){
<shape id="_x0000_i1042" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>//显示我们的数据
<shape id="_x0000_i1043" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1044" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>else{
<shape id="_x0000_i1045" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>$data=get_from_database;//得到数据源
<shape id="_x0000_i1046" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>if(!$memcache->set('k',$data), MEMCACHE_COMPRESSED)//开始设置
<shape id="_x0000_i1047" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>log();//不成功,记录失败信息
<shape id="_x0000_i1048" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>}
<shape id="_x0000_i1049" style="WIDTH: 8.25pt; HEIGHT: 12pt" alt="" type="#_x0000_t75"><imagedata o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image001.gif"></imagedata></shape>?>
-----------OVER-----------