Re: [need for advices] fastCaching
| From: | fabien dot marty at free dot fr | Date: | Mon, 22 Jul 2002 16:33:03 +0000 |
| Subject: | Re: [need for advices] fastCaching | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-7862@lists.php.net to get a copy of this message | ||
(Tomas)
> Sorry I'm not being very clear, change isCached() with getCached(). I
> cursory saw the Cache_Container_XXX::fetch() function as the only
> needed thing (ok, the constructors too).
>
> It of course may be bigger than your class, but I guess that to load a
> little bit more code (still only one file) won't impact in the
> performance and it will be full featured. Perhaps the point is more
> oriented to simplify the Cache design instead of putting a layer on
> top.
>
> Could you provide a bench test script, I'd like to try some things.
Ahhhhhhhh !!! :-)) So, ok...
I'm ok with you, loading a little bit more code won't impact in the performance
but I am not really ok with the design to put all containers in the same file...
Other thing, i'm just finishing to bench jpCache (but jpCache has more advanced
functionalities) :
fastCache : 150 #/s
Cache : 30 #/s
jpCache : 80 #/s
For test scripts,
the one for fastCache :
-----------------------
<?php
require_once('fastCache.php');
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 30
);
$fastCache = new fastCache($options);
if ($data = $fastCache->get('123')) {
echo($data);
} else {
$data = '';
for($i=0;$i<1000;$i++) {
$data .= '0123456789';
}
echo($data);
$fastCache->save('123', $data);
}
?>
the one for Cache :
--------------------
<?php
require_once('Cache.php');
$options = array(
'cache_dir' => '/tmp/'
);
$fastCache = new Cache('file', $options);
if ($data = $fastCache->get('123')) {
echo($data);
} else {
$data = '';
for($i=0;$i<1000;$i++) {
$data .= '0123456789';
}
echo($data);
$fastCache->save('123', $data, 30);
}
?>
And I use for benchs :
ab -c 10 -n 1000 local_URL
Fabien