PHP使用redis实现统计缓存mysql压力的方法_php技巧_脚本之家

2020-02-07 23:42栏目:bob体育平台
TAG:

期待本文所述对我们php程序设计有所援助。

pconnect; if(isset($_SERVER['HTTP_REFERER'])){ $url_md5 = md5($_SERVER['HTTP_REFERER']); } $adve_key = 'adve'; $adve_key_exists = 'adve_exists'; if(!$redis->exists{ $list = $mysql_obj->fetch_array("select * from user_online_adve"); if{ foreach ($list as $key => $value) { $url_hash = md5; $adve_hash_key = $adve_key.":".$url_hash; $id = $value['id']; $redis->set; $redis->set($adve_key_exists,true); //$redis->hmset($adve_hash_key, array; //print_r($redis->get; } } } $adve_new_key = $adve_key.':'.$url_md5; if($redis->exists{ $adve_plus = $adve_new_key.":plus" ; if(!$redis->exists{ $redis->set; }else{ $redis->incr; $num = $redis->get; if{ $id = $redis->get; // insert to sql; $mysql_obj->query("update user_online_adve set adve_num=adve_num+$num where id=$id"); $redis->set; } } } header('HTTP/1.0 301 Moved Permanently'); header('Location: https://itunes.apple.com/cn/app/san-guo-zhi15-ba-wangno-da-lu/id694974270?mt=8');/* if(){ $adve_plus = $adve_key.":plus" ; if($redis->exists{ $redis->incr; }else{ $redis->set; } echo $redis->get; } foreach ($list as $key => $value) { $url_hash = md5; $id = $value['id']; $adve_num = $value['adve_num']; $adve_plus = $adve_key.":plus" ; if($redis->exists{ $redis->incr; }else{ $redis->set; } echo $redis->get; //if //$redis->hmset($adve_key, array('id' =>$id, 'adve_num'=>$adve_num)); //print_r($redis->hmget("adve:$url_hash", array; } print_r;*/

正文实例呈报了PHP使用redis达成总计缓存mysql压力的法子。分享给我们供大家参谋,具体如下:

版权声明:本文由bob体育app发布于bob体育平台,转载请注明出处:PHP使用redis实现统计缓存mysql压力的方法_php技巧_脚本之家