Re: [patch] Cache / File container
| From: | MARTY Fabien | Date: | Thu, 30 May 2002 15:45:14 +0000 |
| Subject: | Re: [patch] Cache / File container | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-6664@lists.php.net to get a copy of this message | ||
(Fabien)
> > File container in PEAR_Cache don't have locking system. So, it's
> > possible, that you get corrupted data-entries under bad circumstances.
> > I have run tests with two scripts running in the same moment (one
> > writing, the second one reading). And it's true that you can get
> > corrupted results when fetching the cache.
> > So I have made a patch to implement locking in the file container.
> > Patch is attached. Can I commit it ?
(Christian)
> not sure, if this is 100% bulletproof, but better than nothing, i assume :)
I have tested it 10000 times : one script getting the cache whereas another
was updating the cache with no problem.
(Christian)
> what about deleting? this is not locked right now, right?
Right but you can't use flock() to do that. And maybe it's not a real
problem. Because, if the file is deleted while you are reading it, maybe you
can continue to read it because the file isn't really destroyed. It must
depend on the OS ???
So, in my opinion, maybe the locking system is not perfect (if someone can
find an example with a problem...), but it's better (for me :-)) than the
current one !
Fabien