Re: Pear::Cache lock files
| From: | Manuel Lemos | Date: | Thu, 14 Feb 2002 07:52:23 +0000 |
| Subject: | Re: Pear::Cache lock files | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-4693@lists.php.net to get a copy of this message | ||
Hello,
Thomas Chille wrote:
>
> Hi,
>
> i'm new here and have one little question:
>
> i read that some problems could occurs if i use files
> to store the cached data, cause the files will not be
> locked while writing access.
> if there any plans to implement that or is that problem
> not so hard for middlesized websites ?
Yes, PEAR Cache file container class does not assure mutual exclusion
when updating a cache file. That can be a problem for sites of any size,
but in sites with greater audience the probablity of cache data
corruption is higher.
You may want to take a look at this other file cache class that uses PHP
file locks to assure mutual exclusing when the cache file is being
updated.
http://phpclasses.upperdesign.com/browse.html/package/313/
I understand that there are some issues with Windows that seem to not
handle file locks the same way and also with multi-threaded Web servers
like Apache 2, even on Unix/Linux like systems because it seems that PHP
file locks are process wide. If that is really an issue I think that the
locking may not work well because two threads of the same process may be
able to concurrently write to the same locked cache file.
Anyway, the file cache class above works well on Linux and Solaris with
Apache 1.x because I use it extensively in that same site that is always
very busy.
Regards,
Manuel Lemos