-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #2517,Add pid support for persistent connection in Redis
Summary: pfsockopen does not supports id. So I changed it stream_socket_client, to handles ids as well. Closes #4291 Reviewed By: @fredemmott Differential Revision: D1693997 Signature: t1:1693997:1417632135:c2b2b2648ee77d911d00e1da801c8698e591c784
- Loading branch information
Showing
7 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
define('REDIS_HOST', getenv('REDIS_TEST_HOST')); | ||
define('REDIS_PORT', getenv('REDIS_TEST_PORT') | ||
? (int)getenv('REDIS_TEST_PORT') | ||
: Redis::DEFAULT_PORT); | ||
define('REDIS_PASS',getenv('REDIS_TEST_PASS')!==null | ||
? getenv('REDIS_TEST_PASS') | ||
: null); | ||
|
||
function NewRedisTestInstance() { | ||
$expecting = array( | ||
'timeout' => 0 | ||
); | ||
$r = new Redis(); | ||
$conn = $r->pconnect(REDIS_HOST, REDIS_PORT, $expecting['timeout']); | ||
var_dump($conn); | ||
$authok = REDIS_PASS ? $r->auth(REDIS_PASS) : true; | ||
var_dump($authok); | ||
return $r; | ||
} | ||
$r = NewRedisTestInstance(); | ||
if ($r) echo true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bool(true) | ||
bool(true) | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
if (!getenv('REDIS_TEST_HOST')) { | ||
echo 'skip'; | ||
} else { | ||
// Some people might have this variable set, but don't have the server running | ||
$output = array(); | ||
exec("redis-cli ping", $output); | ||
if ($output[0] !== "PONG") { | ||
echo 'skip'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
define('REDIS_HOST', getenv('REDIS_TEST_HOST')); | ||
define('REDIS_PORT', getenv('REDIS_TEST_PORT') | ||
? (int)getenv('REDIS_TEST_PORT') | ||
: Redis::DEFAULT_PORT); | ||
define('REDIS_PASS', getenv('REDIS_TEST_PASS') !== null | ||
? getenv('REDIS_TEST_PASS') | ||
: null); | ||
|
||
function NewRedisTestInstance() { | ||
$expecting = array( | ||
'timeout' => 0, | ||
'database' => 0 | ||
); | ||
$r = new Redis(); | ||
$persistentId = REDIS_PORT . $expecting['timeout'] . $expecting['database']; | ||
$conn = $r->pconnect( | ||
REDIS_HOST, REDIS_PORT, $expecting['timeout'], $persistentId); | ||
var_dump($conn); | ||
$authok = REDIS_PASS ? $r->auth(REDIS_PASS) : true; | ||
var_dump($authok); | ||
return $r; | ||
} | ||
|
||
$r = NewRedisTestInstance(); | ||
if ($r) echo true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bool(true) | ||
bool(true) | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
if (!getenv('REDIS_TEST_HOST')) { | ||
echo 'skip'; | ||
} else { | ||
// Some people might have this variable set, but don't have the server running | ||
$output = array(); | ||
exec("redis-cli ping", $output); | ||
if ($output[0] !== "PONG") { | ||
echo 'skip'; | ||
} | ||
} |