Deletes Are Driving Me Crazy

Martin Atkins mart at degeneration.co.uk
Wed Jan 11 23:02:41 UTC 2006


Skylos wrote:
> 
> $mc->delete($key,$val);
> unless ($mc->add($key,$val2)) {
>     $mc->replace($key, $val2);
> }
> 

Be careful of doing things like this. You create the potential for a
race condition if another process gets a request in between each of
these functions. memcached provides several atomic operations to avoid
such problems.




More information about the memcached mailing list