php代码
<?php $test = new redis_test(); $test->totalSize = 100000; $test->run(); class redis_test { public $totalSize=1000000; function printf() { $args = func_get_args(); if(count($args) == 1){ $msg = $args[0].PHP_EOL; }else{ $args[0] = $args[0].PHP_EOL; $msg = call_user_func_array("sprintf", $args); } echo $msg; } function run() { //测试redis->hmset() $this->printf("redis test start"); $redis = new redis(); $redis->connect('127.0.0.1', 6379); $this->test($redis); //测试ssdb->hmset() $this->printf("ssdb test start"); $redis = new redis(); $redis->connect('127.0.0.1', 8888); $this->test($redis); } function test($redis) { //导出一条测试记录 $row = array ( 'id' => '1', 'product' => '1', 'imei' => '000000000000000', 'model' => 'Galaxy Note 3 - 4.4.2 - API 19 - 1080x1920', 'vcode' => '6', 'vcoded' => '11', 'channel' => '10001', 'download' => '0', 'ctime' => '1395992425', 'year' => '2014', 'month' => '201403', 'week' => '201413', 'day' => '20140328', 'day1' => '1', 'day2' => '1', 'day3' => '1', 'day4' => '1', 'day5' => '1', 'day6' => '1', 'day7' => '1', 'day14' => '1', 'day30' => '0', 'day60' => '0', 'vcode_1' => '0', 'vcode_2' => '0', 'vcode_3' => '0', 'vcode_6' => '20140710', 'vcode_7' => '20140331', 'vcode_8' => '0', 'vcode_9' => '20140414', 'vcode_10' => '0', 'vcode_11' => '20140710', 'vcode_12' => '0', 'vcode_13' => '0', 'vcode_14' => '0', 'vcode_15' => '0', 'vcode_16' => '0', 'vcode_17' => '0', 'vcode_18' => '0', 'vcode_19' => '0', 'last_act_year' => '2014', 'last_act_month' => '201407', 'last_act_week' => '201428', 'last_act_day' => '20140710', 'offday' => '77', 'lose' => '1', ); $this->printf("Job start, %s, %s", $this->memory_get_usage(), date("Y-m-d H:i:s")); for($i=1; $i<=$this->totalSize; $i++) { $row["id"] = $i; $row["imei"] = md5(rand(). microtime(true)); $row["model"] = rand(); $redis->hmset($row["imei"], $row); if($i % 10000 === 0) $this->printf("Job %s done, %s, %s", $i, $this->memory_get_usage(), date("Y-m-d H:i:s")); } $this->printf("Job start, %s, %s", $this->memory_get_usage(), date("Y-m-d H:i:s")); } function memory_get_usage() { $size = memory_get_usage(true); $unit=array('b ','kb','mb','gb','tb','pb'); return sprintf("%02f", @round($size/pow(1024,($i=floor(log($size,1024)))), 2)).' '.$unit[$i]; } }
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章
刺客信條陰影:貝殼謎語解決方案
3 週前ByDDD
Windows 11 KB5054979中的新功能以及如何解決更新問題
2 週前ByDDD
在哪裡可以找到原子中的起重機控制鑰匙卡
3 週前ByDDD
<🎜>:死鐵路 - 如何完成所有挑戰
4 週前ByDDD
Atomfall指南:項目位置,任務指南和技巧
1 個月前ByDDD

熱工具

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

mPDF
mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

Atom編輯器mac版下載
最受歡迎的的開源編輯器

禪工作室 13.0.1
強大的PHP整合開發環境