diff options
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() { |