[Pkg-owncloud-commits] [owncloud] 183/215: use trait for cas polyfill for xcache

David Prévot taffit at moszumanska.debian.org
Tue May 5 01:01:48 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit a40a237441670a4c575a224158b4a2a7c2fb5266
Author: Robin Appelman <icewind at owncloud.com>
Date:   Thu Apr 30 13:39:31 2015 +0200

    use trait for cas polyfill for xcache
---
 lib/private/memcache/xcache.php | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/lib/private/memcache/xcache.php b/lib/private/memcache/xcache.php
index 3a5bd73..0be79d0 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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list