diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
commit | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch) | |
tree | 577a29fb579188d16003a209ce2a2e9c5b0aa2bd /includes/objectcache/HashBagOStuff.php | |
parent | cacc939b34e315b85e2d72997811eb6677996cc1 (diff) |
Update to MediaWiki 1.21.1
Diffstat (limited to 'includes/objectcache/HashBagOStuff.php')
-rw-r--r-- | includes/objectcache/HashBagOStuff.php | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/includes/objectcache/HashBagOStuff.php b/includes/objectcache/HashBagOStuff.php index 799f26a3..d061eff0 100644 --- a/includes/objectcache/HashBagOStuff.php +++ b/includes/objectcache/HashBagOStuff.php @@ -52,9 +52,10 @@ class HashBagOStuff extends BagOStuff { /** * @param $key string + * @param $casToken[optional] mixed * @return bool|mixed */ - function get( $key ) { + function get( $key, &$casToken = null ) { if ( !isset( $this->bag[$key] ) ) { return false; } @@ -63,6 +64,8 @@ class HashBagOStuff extends BagOStuff { return false; } + $casToken = $this->bag[$key][0]; + return $this->bag[$key][0]; } @@ -78,6 +81,21 @@ class HashBagOStuff extends BagOStuff { } /** + * @param $casToken mixed + * @param $key string + * @param $value mixed + * @param $exptime int + * @return bool + */ + function cas( $casToken, $key, $value, $exptime = 0 ) { + if ( $this->get( $key ) === $casToken ) { + return $this->set( $key, $value, $exptime ); + } + + return false; + } + + /** * @param $key string * @param $time int * @return bool @@ -91,12 +109,4 @@ class HashBagOStuff extends BagOStuff { return true; } - - /** - * @return array - */ - function keys() { - return array_keys( $this->bag ); - } } - |