summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-14 16:08:47 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-14 16:08:47 +0100
commit852acd364a229260553d9b3bcc36d6de3047fa57 (patch)
tree746ca1a29d3f87729804b5d55c1688f297bc02c4 /lib
parent2934b7e694a40fb2d172468a610eb736c042776e (diff)
parent2f67aa9bc41df280c9ac869b0387710eb3995ed1 (diff)
downloadnextcloud-server-852acd364a229260553d9b3bcc36d6de3047fa57.tar.gz
nextcloud-server-852acd364a229260553d9b3bcc36d6de3047fa57.zip
Merge pull request #23218 from owncloud/memcached-not-found-on-remove-means-success
Fix errors in memcached implementation
Diffstat (limited to 'lib')
-rw-r--r--lib/private/memcache/memcached.php21
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;
}