I tried using your lib, I found problems, I hope that you can explain to me about it. Here is my code :
<?php
define(“BASEPATH”,$_SERVER[‘DOCUMENT_ROOT’].“cache_test/”);
include(“Cache.php”);
$cache = new Cache();
$ID=“1234425”;
$time_start = microtime(true);
if(!$data = $cache->get($ID)){
$link = mysql_connect(“localhost”,“root”,”“);
$conn = mysql_select_db(“ASF”,$link);
$sSQL = “SELECT * FROM RESERVATION_SIMULATED”;
$rs=mysql_query($sSQL);
$count=0;
while($row=mysql_fetch_array($rs)){
$data[]=$row;
$count++;
if($count>40000){
break;
}
}
$cache->save($ID,$data);
echo “cached successful”;
}
echo “
Record : “. count($data);
$time_end = microtime(true);
$time = $time_end - $time_start;
echo “
Time spent : $time seconds\n”;
?>
Here is the result
- The first time :
cached successful
Record : 40001
Time spent : 2.1360259056091 seconds
- The second time (after caching):
Record : 40001
Time spent : 4.4445600509644 seconds