diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-03-14 14:34:11 +0300 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-03-14 18:13:35 +0300 |
commit | 9190885b4e0bdcec4c7f3fafd3f0eb2dd727c716 (patch) | |
tree | 1d466e21944690fbb69f74fe0b375cb7a1d25ceb /lib | |
parent | 5c38c1c8454d10a46fcd58eab82f5732f9c431a1 (diff) |
Fix errors in memcached implementation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/memcache/memcached.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/private/memcache/memcached.php b/lib/private/memcache/memcached.php index c13be68b47f..a30f9da7ed7 100644 --- a/lib/private/memcache/memcached.php +++ b/lib/private/memcache/memcached.php @@ -88,7 +88,9 @@ class Memcached extends Cache implements IMemcache { public function remove($key) { $result= self::$cache->delete($this->getNamespace() . $key); - $this->verifyReturnCode(); + if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { + $this->verifyReturnCode(); + } return $result; } @@ -124,10 +126,13 @@ class Memcached extends Cache implements IMemcache { * @param mixed $value * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 * @return bool + * @throws \Exception */ public function add($key, $value, $ttl = 0) { $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); - $this->verifyReturnCode(); + if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) { + $this->verifyReturnCode(); + } return $result; } @@ -141,7 +146,11 @@ class Memcached extends Cache implements IMemcache { public function inc($key, $step = 1) { $this->add($key, 0); $result = self::$cache->increment($this->getPrefix() . $key, $step); - $this->verifyReturnCode(); + + if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { + return false; + } + return $result; } @@ -154,7 +163,11 @@ class Memcached extends Cache implements IMemcache { */ public function dec($key, $step = 1) { $result = self::$cache->decrement($this->getPrefix() . $key, $step); - $this->verifyReturnCode(); + + if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { + return false; + } + return $result; } |