|
Posted by Evert | Rooftop on 05/16/05 22:09
Hi,
I'm developing a cache system. Which works in pseude code, like this:
class Cache {
function Fetchdata($id1,$id2,$id3) {
$id = md5($id1 . $id2 . $id3);
if ($this->DataIsExpired($id)) return false;
else return unserialize(file_get_contents($id));
}
function storeData($data,$id1,$id2,$id3) {
$id = md5($id1 . $id2 . $id3);
OpenTheFileAndWriteTheDataSerialized($data);
}
}
$id1 $id2 and $id3 are when they are combined unique
* Is there a chance of collision when MD5 is used on the id's and the
ids are long strings
* Is file_get_contents the fastest way to open the file?
* Is serialize the fastest way to serialize ;) ?
* Are there any other things I should consider? (I'm aware of
file-locking issues, and have taken care of that)
regards,
Evert
[Back to original message]
|