Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 99af20e

Browse files
committed
ported change to RENAMENX from upstream Redis.
1 parent 8002120 commit 99af20e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

redis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,9 +733,9 @@ PHP_METHOD(Redis, renameNx)
733733

734734
REDIS_PROCESS_REQUEST(redis_sock, cmd, cmd_len);
735735
IF_ATOMIC() {
736-
redis_boolean_response(INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, NULL, NULL);
736+
redis_1_response(INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, NULL, NULL);
737737
}
738-
REDIS_PROCESS_RESPONSE(redis_boolean_response);
738+
REDIS_PROCESS_RESPONSE(redis_1_response);
739739

740740
}
741741
/* }}} */

tests/TestRedis.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function testRename() {
218218
public function testRenameNx() {
219219

220220
// strings
221-
$this->redis->delete('key0');
221+
$this->redis->delete('key0', 'key1');
222222
$this->redis->set('key0', 'val0');
223223
$this->redis->set('key1', 'val1');
224224
$this->assertTrue($this->redis->renameNx('key0', 'key1') === FALSE);
@@ -232,12 +232,12 @@ public function testRenameNx() {
232232
$this->redis->lPush('key0', 'val1');
233233
$this->redis->lPush('key1', 'val1-0');
234234
$this->redis->lPush('key1', 'val1-1');
235-
$this->redis->renameNx('key0', 'key1');
235+
$this->assertTrue($this->redis->renameNx('key0', 'key1') === FALSE);
236236
$this->assertTrue($this->redis->lGetRange('key0', 0, -1) === array('val1', 'val0'));
237237
$this->assertTrue($this->redis->lGetRange('key1', 0, -1) === array('val1-1', 'val1-0'));
238238

239239
$this->redis->delete('key2');
240-
$this->redis->renameNx('key0', 'key2');
240+
$this->assertTrue($this->redis->renameNx('key0', 'key2') === TRUE);
241241
$this->assertTrue($this->redis->lGetRange('key0', 0, -1) === array());
242242
$this->assertTrue($this->redis->lGetRange('key2', 0, -1) === array('val1', 'val0'));
243243

0 commit comments

Comments
 (0)