diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-02-28 22:17:40 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-02-28 22:17:40 +0100 |
commit | fa3f2e9c2dcf1fdf329778a77c2dfd2d4416f131 (patch) | |
tree | 279f22edf68fb90992c53bf0908cd35e3af04885 /application | |
parent | 10daac79846bbae460b0cc539f14e155f60a4aae (diff) |
memcachelibrary: Ignore server unreachable errors in set() and delete()
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r-- | application/libraries/MemcacheLibrary.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/application/libraries/MemcacheLibrary.php b/application/libraries/MemcacheLibrary.php index dc993b7a5..1716a1d10 100644 --- a/application/libraries/MemcacheLibrary.php +++ b/application/libraries/MemcacheLibrary.php @@ -110,7 +110,15 @@ class MemcacheLibrary { $this->logDebugMessage( sprintf("%s key set to memcache. (expire: %s)",$key, $expire) ); - return $this->memcachedInstance->set($key, $value, null, $expire); + + // hide notice if server is unreachable + $old_error_level = error_reporting(); + error_reporting($old_error_level & ~E_NOTICE); + + $ret = $this->memcachedInstance->set($key, $value, null, $expire); + + error_reporting($old_error_level); + return $ret; } /** @@ -120,7 +128,14 @@ class MemcacheLibrary { */ public function delete($key) { $this->logDebugMessage(sprintf("%s key deleted from memcache.", $key)); - return $this->memcachedInstance->delete($key); + // hide notice if server is unreachable + $old_error_level = error_reporting(); + error_reporting($old_error_level & ~E_NOTICE); + + $ret = $this->memcachedInstance->delete($key); + + error_reporting($old_error_level); + return $ret; } /** |