note 56771 added to ref.memcache

From: Date: Wed, 14 Sep 2005 20:19:49 +0000
Subject: note 56771 added to ref.memcache
Groups: php.notes 
Request: Send a blank email to php-notes+get-95187@lists.php.net to get a copy of this message
An improvement to the above: The above class will cause an error if all cache servers are down. The preferred behavior is to just have a cache miss (or take no action in the case of write operations) and return false, so the app can run in non-cached mode if all cache servers are down. To make this happen, simply change the connection usage to look something like this in each affected function. This code is for the get() function: $con = $this->_getConForKey($key); if ($con === false) return false; return $con->get($key); Similarly, the affected code in the set() function would look like this: $con = $this->_getConForKey($key); if ($con === false) return false; return $con->set($key, $var, $compress, $expire); Modify each function accordingly, and if all of your cache servers are down, you can still function (although more slowly due to the 100% cache miss rate). ---- Manual Page -- http://www.php.net/manual/en/ref.memcache.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56771 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56771&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56771&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56771&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56771&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56771&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56771&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56771&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95187) next »