后端开发|php教程
php,memcache,操作
后端开发-php教程
php中memcache 基本操作实例
dede模板包括后台源码,vscode怎么编译,ubuntu 管理员,tomcat缓存清理,sqlite3 语句,深圳龙岗网页设计公司,数据库中删除重复数据,免费的云服务器地址,投票制作软件插件,多前端框架,携程 爬虫,php采集,珠海seo,springboot部署文档,dede 列表页调用tag标签,企业网站留言板,儿童节网页模板,在线留言模板,dede 后台查看留言,html5 微信 打赏页面,有后台管理系统的屏幕,html5源程序 手机版lzw
";$memcache->delete("name1");echo"name1:".$memcache->get("name1")."
";$array_get = array("name1","name2","name3");$result_get = $memcache->get($array_get);foreach ($result_get as $key => $value) {echo"$key:--->$value
";}foreach ($memcache->getStats() as $key => $value) {echo"$key:--->$value
";};echo"
";foreach($memcache->getExtendedStats() as $key => $value) {echo"$key:--->$value
";}$memcache->close();?>
php婚纱网站源码,ubuntu 查网卡型号,js加载图片 爬虫,ksort() php,seo销售模式lzw
我们再来看个更加具体些的实例
php mysql 留言板源码,vscode跳转功能,ubuntu上传文件被拒绝,tomcat证书使用,图片保存到sqlite,网站插件代码大全,php开发前端的框架,网络爬虫软件招标,php 默认值,SEO霸屏营销,免费软件模板下载网站,网页 图片切换,织梦会员空间模板安装,页面下载,微校园管理系统源码,小程序平台源码免费lzw
connect(localhost, 11211);$expires=15*60;//check if cache exitsif(($value = $mem-> get($city)) != FALSE) {echo "get key from memcache: "."
";// $return=$mem->get($city);// echo json_encode($return);}//ifelse {$resultJson=fetch_data();echo count($resultJson)."
";if(count($resultJson)==1 || empty($resultJson)){//从mysql中取值echo "get key from mysql:"."
";$query="select * from pm25";$result=mysql_query ($query) ;while ($row = mysql_fetch_assoc($result)){$rows[]=$row;}//将获取的值数组存入memcachefor($i=0;$i set($k[$i], $v[$i], false, $expires);}// $return=$mem->get($city);// echo json_encode($return);}//ifelse{echo "get key from new_writed mysql:"."
";write_db($resultJson);$query="select * from pm25";$result=mysql_query ($query) ;while ($row = mysql_fetch_assoc($result)){$rows[]=$row;}//write memcachefor($i=0;$i set($k[$i], $v[$i], false, $expires);}// $return=$mem->get($city);// echo json_encode($return);}//else}//elseforeach ($city as $k=>$v){$return[$k]=$mem->get($v);}echo json_encode($return);function fetch_data() {$url="";//$url="";$data = http_get($url);$getJson = json_decode($data, true);return $getJson;} //func fetch_datafunction write_db($getJson){$sql="DELETE FROM pm25";mysql_query($sql);//sort the json.txtforeach ($getJson as $key => $row) {$area[$key] = $row[area];$pm2_5[$key]= $row[pm2_5];}array_multisort($area, SORT_ASC,$pm2_5,SORT_ASC,$getJson);for($i=0;$i<count($getJson)-1;$i++){if($getJson[$i][pm2_5]==0)$count=0;else$count=1;$sum=$getJson[$i][pm2_5];for($j=$i+1;$j close();?>
以上所述就是本文的全部内容了,希望大家能够喜欢。