return $result;
}
- public function incr( $key, $value = 1 ) {
+ public function incr( $key, $value = 1, $flags = 0 ) {
$conn = $this->getConnection( $key );
if ( !$conn ) {
return false;
return $result;
}
+ public function decr( $key, $value = 1, $flags = 0 ) {
+ $conn = $this->getConnection( $key );
+ if ( !$conn ) {
+ return false;
+ }
+
+ try {
+ if ( !$conn->exists( $key ) ) {
+ return false;
+ }
+ // @FIXME: on races, the key may have a 0 TTL
+ $result = $conn->decrBy( $key, $value );
+ } catch ( RedisException $e ) {
+ $result = false;
+ $this->handleException( $conn, $e );
+ }
+
+ $this->logRequest( 'decr', $key, $conn->getServer(), $result );
+
+ return $result;
+ }
+
protected function doChangeTTL( $key, $exptime, $flags ) {
$conn = $this->getConnection( $key );
if ( !$conn ) {