diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-04-30 13:39:31 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-04-30 14:48:39 +0200 |
commit | a40a237441670a4c575a224158b4a2a7c2fb5266 (patch) | |
tree | e14a05574846e44786afe2c2031e234b9d91b81b /lib | |
parent | 96f9573a4b0addc4b0fad6a6ac2faef8da187aff (diff) | |
download | nextcloud-server-a40a237441670a4c575a224158b4a2a7c2fb5266.tar.gz nextcloud-server-a40a237441670a4c575a224158b4a2a7c2fb5266.zip |
use trait for cas polyfill for xcache
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/memcache/xcache.php | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/lib/private/memcache/xcache.php b/lib/private/memcache/xcache.php index 3a5bd73d8ad..0be79d06ed9 100644 --- a/lib/private/memcache/xcache.php +++ b/lib/private/memcache/xcache.php @@ -32,6 +32,8 @@ use OCP\IMemcache; * functions etc. */ class XCache extends Cache implements IMemcache { + use CASTrait; + /** * entries in XCache gets namespaced to prevent collisions between ownCloud instances and users */ @@ -107,30 +109,6 @@ class XCache extends Cache implements IMemcache { return xcache_dec($this->getPrefix() . $key, $step); } - /** - * Compare and set - * - * @param string $key - * @param mixed $old - * @param mixed $new - * @return bool - */ - public function cas($key, $old, $new) { - //no native cas, emulate with locking - if ($this->add($key . '_lock', true)) { - if ($this->get($key) === $old) { - $this->set($key, $new); - $this->remove($key . '_lock'); - return true; - } else { - $this->remove($key . '_lock'); - return false; - } - } else { - return false; - } - } - static public function isAvailable() { if (!extension_loaded('xcache')) { return false; |