note 89005 added to function.memcache-add

From: Date: Wed, 18 Feb 2009 08:47:30 +0000
Subject: note 89005 added to function.memcache-add
Groups: php.notes 
Request: Send a blank email to php-notes+get-150775@lists.php.net to get a copy of this message
If you want to add an entry without using the locking method below (takes up extra space), try it this way: if(!$mc->replace("key", $data)) $mc->set("key", $data; That way it will simply try to overwrite the value if a user has already (re)created the key. This is best in high-traffic sites where a user set()'s the data while another user has already tried a get() check and found nothing. Even this method still leaves a small microsecond window open for the same thing. However it helps prevent nasty glitches with submitting multiple entries after a get() check and the system has taken time to recompile the data to send to Memcached, after another user's request has processed this transaction. ---- Server IP: 69.147.83.197 Probable Submitter: 71.165.197.5 ---- Manual Page -- http://www.php.net/manual/en/function.memcache-add.php Edit -- https://master.php.net/note/edit/89005 Del: integrated -- https://master.php.net/note/delete/89005/integrated Del: useless -- https://master.php.net/note/delete/89005/useless Del: bad code -- https://master.php.net/note/delete/89005/bad+code Del: spam -- https://master.php.net/note/delete/89005/spam Del: non-english -- https://master.php.net/note/delete/89005/non-english Del: in docs -- https://master.php.net/note/delete/89005/in+docs Del: other reasons-- https://master.php.net/note/delete/89005 Reject -- https://master.php.net/note/reject/89005 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150775) next »