[fastCache] Answers...
| From: | MARTY Fabien | Date: | Tue, 23 Jul 2002 01:14:32 +0000 |
| Subject: | [fastCache] Answers... | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-7884@lists.php.net to get a copy of this message | ||
Hello,
To avoid multiple mails, I'm going to make a big one only.
(Brent)
[about corruption tests...]
File Locking doestn't work with NFS so it's normal that you can have
corrupted cache. So, I'm completly agree with a corruption test. I have
rapidly benched the add of file length in cache and it's ok with perfs.
An optional md5 hash test would be also a good point.
(Richard)
[about testing the cache just after writing it...]
'seems to be a good idea. Because, perfs are important for cache reading
not for cache writing. With this solution, we could do a md5 hash by
default. Any hidden problem with this clever solution ?
(Tomas)
[About md5 hash of the data as part of the file name...]
You have plenty of ideas ! ;-) But to open it without knowing the data,
we would have to search the file in the directory. Maybe, it would take
some time ?
(Tomas)
[Application level lock...]
Not good for perfs ! ;-) And if the application level lock is stored in
files, the problem is still here : avoid corruption in application level
control files...
(pa)
[goals of fastCache...]
In the next mail :-)
(Martin)
[Another name for fastCache...]
If fastCache is not a good name, I have really no idea ? Someone in the
list ? :-)
(Olivier)
[about caching block only...]
No problem with that. Because you choose the data to put in cache.
For example :
<?
require_once('fastCache.php');
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 10
);
$fastCache = new fastCache($options);
if ($data = $fastCache->get('block1')) {
echo($data);
} else {
$data = 'cache of block 1';
$fastCache->save('block1', $data);
}
echo('this is not a cache');
if ($data = $fastCache->get('block2')) {
echo($data);
} else {
$data = 'cache of block 2';
$fastCache->save('block2', $data);
}
?>
Fabien