cvs: pear /Cache_Lite/tests bench3.php test3.php
| From: | Fabien MARTY | Date: | Sat, 10 Aug 2002 21:07:01 +0000 |
| Subject: | cvs: pear /Cache_Lite/tests bench3.php test3.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5665@lists.php.net to get a copy of this message | ||
fab Sat Aug 10 17:07:01 2002 EDT
Added files:
/pear/Cache_Lite/tests test3.php bench3.php
Log:
Add of testing stuff for Cache_Lite_Function
Index: pear/Cache_Lite/tests/test3.php
+++ pear/Cache_Lite/tests/test3.php
<?php
// Test script of Cache_Lite_Function
// $Id: test3.php,v 1.1 2002/08/10 21:07:01 fab Exp $
require_once('../Cache_Lite_Function.php');
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 10
);
$cache = new Cache_Lite_Function($options);
$data = $cache->call('function_to_bench', 23, 66);
echo($data);
$object = new bench();
$object->test = 666;
$data = $cache->call('object->method_to_bench', 23, 66);
echo($data);
$data = $cache->call('bench::static_method_to_bench', 23, 66);
echo($data);
function function_to_bench($arg1, $arg2)
{
echo "This is the output of the function function_to_bench($arg1, $arg2) !<br>";
return "This is the result of the function function_to_bench($arg1, $arg2)
!<br>";
}
class bench
{
var $test;
function method_to_bench($arg1, $arg2)
{
echo "\$obj->test = $this->test and this is the output of the method
\$obj->method_to_bench($arg1, $arg2) !<br>";
return "\$obj->test = $this->test and this is the result of the method
\$obj->method_to_bench($arg1, $arg2) !<br>";
}
function static_method_to_bench($arg1, $arg2) {
echo "This is the output of the function static_method_to_bench($arg1, $arg2)
!<br>";
return "This is the result of the function static_method_to_bench($arg1, $arg2)
!<br>";
}
}
?>
Index: pear/Cache_Lite/tests/bench3.php
+++ pear/Cache_Lite/tests/bench3.php
<?php
// Bench script of Cache_Lite_Function
// $Id: bench3.php,v 1.1 2002/08/10 21:07:01 fab Exp $
require_once('../Cache_Lite_Function.php');
$options = array(
'caching' => true,
'cacheDir' => '/tmp/',
'lifeTime' => 10
);
$cache = new Cache_Lite_Function($options);
$data = $cache->call('function_to_bench', 23, 66);
echo($data);
$object = new bench();
$object->test = 666;
$data = $cache->call('object->method_to_bench', 23, 66);
echo($data);
$data = $cache->call('bench::static_method_to_bench', 23, 66);
echo($data);
function function_to_bench($arg1, $arg2)
{
for($i=0;$i<10000;$i++) {
$tmp = md5(md5(md5('Loosing time...')));
}
echo "This is the output of the function function_to_bench($arg1, $arg2) !<br>";
return "This is the result of the function function_to_bench($arg1, $arg2)
!<br>";
}
class bench
{
var $test;
function method_to_bench($arg1, $arg2)
{
for($i=0;$i<10000;$i++) {
$tmp = md5(md5(md5('Loosing time...')));
}
echo "\$obj->test = $this->test and this is the output of the method
\$obj->method_to_bench($arg1, $arg2) !<br>";
return "\$obj->test = $this->test and this is the result of the method
\$obj->method_to_bench($arg1, $arg2) !<br>";
}
function static_method_to_bench($arg1, $arg2) {
for($i=0;$i<10000;$i++) {
$tmp = md5(md5(md5('Loosing time...')));
}
echo "This is the output of the function static_method_to_bench($arg1, $arg2)
!<br>";
return "This is the result of the function static_method_to_bench($arg1, $arg2)
!<br>";
}
}
?>