note 89745 added to function.memcache-add
| From: | web_fella at hotmail dot com | Date: | Fri, 20 Mar 2009 23:41:04 +0000 |
| Subject: | note 89745 added to function.memcache-add | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152244@lists.php.net to get a copy of this message | ||
the example posted by conrad1986 is not a safe lock implementation. If 2 web server threads try to
set the same key in memcache, it creates a race condition, because both processes could get past the
replace() call, and then both processes would call set. The add example posted by "php at
tapirpirates dot net" on 03-Apr-2008 04:32 is safer, because memcache_add combines get and set
behavior in one atomic operation.
----
Server IP: 80.81.171.181
Probable Submitter: 76.19.119.115
----
Manual Page -- http://www.php.net/manual/en/function.memcache-add.php
Edit -- https://master.php.net/note/edit/89745
Del: integrated -- https://master.php.net/note/delete/89745/integrated
Del: useless -- https://master.php.net/note/delete/89745/useless
Del: bad code -- https://master.php.net/note/delete/89745/bad+code
Del: spam -- https://master.php.net/note/delete/89745/spam
Del: non-english -- https://master.php.net/note/delete/89745/non-english
Del: in docs -- https://master.php.net/note/delete/89745/in+docs
Del: other reasons-- https://master.php.net/note/delete/89745
Reject -- https://master.php.net/note/reject/89745
Search -- https://master.php.net/manage/user-notes.php