X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FRESTBagOStuff.php;h=82b5ac05bfa623ea695cf7223f25d7e8b416a018;hb=94eb0c946f249aace839ec3876b6ab11e7fc39b8;hp=aa4a9b31fcc7219e03f89c8b2e8f85e8d11ddcb1;hpb=adae85b18dec227a9c88061a6ba661b6ebbe62a5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/RESTBagOStuff.php b/includes/libs/objectcache/RESTBagOStuff.php index aa4a9b31fc..82b5ac05bf 100644 --- a/includes/libs/objectcache/RESTBagOStuff.php +++ b/includes/libs/objectcache/RESTBagOStuff.php @@ -164,7 +164,7 @@ class RESTBagOStuff extends MediumSpecificBagOStuff { return $this->handleError( "Failed to store $key", $rcode, $rerr, $rhdrs, $rbody ); } - public function add( $key, $value, $exptime = 0, $flags = 0 ) { + protected function doAdd( $key, $value, $exptime = 0, $flags = 0 ) { // @TODO: make this atomic if ( $this->get( $key ) === false ) { return $this->set( $key, $value, $exptime, $flags ); @@ -188,11 +188,11 @@ class RESTBagOStuff extends MediumSpecificBagOStuff { return $this->handleError( "Failed to delete $key", $rcode, $rerr, $rhdrs, $rbody ); } - public function incr( $key, $value = 1 ) { + public function incr( $key, $value = 1, $flags = 0 ) { // @TODO: make this atomic $n = $this->get( $key, self::READ_LATEST ); if ( $this->isInteger( $n ) ) { // key exists? - $n = max( $n + intval( $value ), 0 ); + $n = max( $n + (int)$value, 0 ); // @TODO: respect $exptime return $this->set( $key, $n ) ? $n : false; } @@ -200,6 +200,10 @@ class RESTBagOStuff extends MediumSpecificBagOStuff { return false; } + public function decr( $key, $value = 1, $flags = 0 ) { + return $this->incr( $key, -$value, $flags ); + } + /** * Processes the response body. *