diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-04-29 16:34:36 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-04-30 14:48:39 +0200 |
commit | acf30ede95f4b8986787f81edcf025a84237b7c5 (patch) | |
tree | 8bfd36e370c084793f98a6cf0366916ab27f66cb /lib/private/memcache/arraycache.php | |
parent | 29213b6136a4b2f71e5f981e9bc08e3e76128d4e (diff) | |
download | nextcloud-server-acf30ede95f4b8986787f81edcf025a84237b7c5.tar.gz nextcloud-server-acf30ede95f4b8986787f81edcf025a84237b7c5.zip |
add compare and swap to memcache
Diffstat (limited to 'lib/private/memcache/arraycache.php')
-rw-r--r-- | lib/private/memcache/arraycache.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/private/memcache/arraycache.php b/lib/private/memcache/arraycache.php index 6db920a69a8..2b1b87a9eb3 100644 --- a/lib/private/memcache/arraycache.php +++ b/lib/private/memcache/arraycache.php @@ -131,6 +131,22 @@ class ArrayCache extends Cache implements IMemcache { } /** + * Compare and set + * + * @param string $key + * @param mixed $old + * @param mixed $new + * @return bool + */ + public function cas($key, $old, $new) { + if ($this->get($key) === $old) { + return $this->set($key, $new); + } else { + return false; + } + } + + /** * {@inheritDoc} */ static public function isAvailable() { |