Posted by Jochem Maas on 10/14/05 15:06
Ruben Rubio Rey wrote:
>
> Hi,
>
> I m creating a cache system, and i have a problem: PHP takes a lot of
> time opening the file. (Im using 2.6.9-1.667smp and XFS)
>
> * For files less or equal 6 Kb, takes arround 0.02-0.03 miliseconds -
> its ok
> * For files arround 35 Kb takes arround 0.2-0.4 miliseconds - too much.
>
> What can I do to make faster opening files?
faster disks.
alternatively if you have RAM to spare you can mount a RAM partition
and write and read all your cache files from there (I do it on
some machine with session files too)
there is also file_get_contents()
>
> **************************************************************
> Source code:
> if(file_exists($filename)){
> $modified_date=filemtime($filename);
> if(time()<($modified_date+1 * 24 * 60 * 60)){
> $handle = fopen($filename, "r");
> $contents = fread($handle, filesize($filename));
> fclose($handle);
> echo $contents;
> }
> }
> **************************************************************
>
> Thinks that I have tried:
> * fopen is *much* faster than include
> * filemtime is faster than filectime
> * Pear Cache its too much slower (0.5-0.7 milsecond per file)
>
> Thanks in advance
> Tk421
>
[Back to original message]
|