Re: [patch] Cache / File container
| From: | Christian Stocker | Date: | Thu, 30 May 2002 17:12:48 +0000 |
| Subject: | Re: [patch] Cache / File container | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6669@lists.php.net to get a copy of this message | ||
Hi again
Go ahead and commit it, if you think it's the solution (don't wanna be
sarcastic about that, i just have no time to check it by myself :) )
chregu
On Thu, 30 May 2002, MARTY Fabien wrote:
> (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
>
>
--
nam...christian stocker adr...bremgartnerstr. 66, ch-8003 zurich
pho...+41 1 451 6021 www...http://phant.ch/chregu
mob...+41 76 561 8860 ema...chregu@phant.ch
wor...+41 1 240 5670 gpg...0x5CE1DECB