dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
objectcache: improve BagOStuff arithmetic method signatures
[lhc/web/wiklou.git]
/
includes
/
libs
/
objectcache
/
RESTBagOStuff.php
diff --git
a/includes/libs/objectcache/RESTBagOStuff.php
b/includes/libs/objectcache/RESTBagOStuff.php
index
aa4a9b3
..
82b5ac0
100644
(file)
--- 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 );
}
return $this->handleError( "Failed to store $key", $rcode, $rerr, $rhdrs, $rbody );
}
- p
ublic function a
dd( $key, $value, $exptime = 0, $flags = 0 ) {
+ p
rotected function doA
dd( $key, $value, $exptime = 0, $flags = 0 ) {
// @TODO: make this atomic
if ( $this->get( $key ) === false ) {
return $this->set( $key, $value, $exptime, $flags );
// @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 );
}
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?
// @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;
}
// @TODO: respect $exptime
return $this->set( $key, $n ) ? $n : false;
}
@@
-200,6
+200,10
@@
class RESTBagOStuff extends MediumSpecificBagOStuff {
return false;
}
return false;
}
+ public function decr( $key, $value = 1, $flags = 0 ) {
+ return $this->incr( $key, -$value, $flags );
+ }
+
/**
* Processes the response body.
*
/**
* Processes the response body.
*