Welcome Guest, Not a member yet? Register   Sign In
Cache library
#17

[eluser]Unknown[/eluser]
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 "<br /> Record : ". count($data);
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "<br />Time spent : $time seconds\n";
?&gt;
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


Messages In This Thread
Cache library - by El Forum - 07-24-2007, 01:22 AM
Cache library - by El Forum - 07-24-2007, 07:02 AM
Cache library - by El Forum - 07-25-2007, 04:01 AM
Cache library - by El Forum - 07-25-2007, 09:30 AM
Cache library - by El Forum - 07-25-2007, 10:03 AM
Cache library - by El Forum - 07-26-2007, 01:57 AM
Cache library - by El Forum - 07-26-2007, 12:49 PM
Cache library - by El Forum - 07-26-2007, 12:55 PM
Cache library - by El Forum - 08-13-2007, 01:33 PM
Cache library - by El Forum - 12-28-2007, 04:44 AM
Cache library - by El Forum - 02-24-2008, 12:24 AM
Cache library - by El Forum - 07-18-2008, 03:13 AM
Cache library - by El Forum - 12-17-2008, 04:38 PM
Cache library - by El Forum - 12-17-2008, 05:19 PM
Cache library - by El Forum - 06-11-2009, 12:09 AM
Cache library - by El Forum - 09-18-2009, 02:02 PM
Cache library - by El Forum - 11-04-2009, 03:12 AM
Cache library - by El Forum - 04-12-2011, 02:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB