-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "unix_socket" setting for Reids, MongoDB, Memcache and Memcached …
…drivers.
- Loading branch information
1 parent
90a3657
commit 15fd0e8
Showing
11 changed files
with
160 additions
and
26 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
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
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 |
---|---|---|
|
@@ -75,6 +75,9 @@ public function __construct(array $setting = []) | |
'pass' => null, | ||
'dbname' => 'test', | ||
'collection' => 'cache_data', | ||
|
||
// If the UNIX socket is set, host, port will be ignored. | ||
'unix_socket' => '', | ||
]; | ||
|
||
foreach (array_keys($config) as $key) { | ||
|
@@ -102,6 +105,7 @@ protected function connect(array $config): void | |
{ | ||
if (extension_loaded('mongodb')) { | ||
try { | ||
|
||
$auth = ''; | ||
$dababase = ''; | ||
|
||
|
@@ -116,10 +120,16 @@ protected function connect(array $config): void | |
$dababase = '/' . $config['dbname']; | ||
} | ||
|
||
// Basic => mongodb://127.0.0.1:27017 | ||
// mongodb://user:[email protected]:27017/dbname | ||
$command = 'mongodb://' . $auth . $config['host'] . ':' . $config['port'] . $dababase; | ||
|
||
if (!empty($config['unix_socket'])) { | ||
// @codeCoverageIgnoreStart | ||
$command = 'mongodb://' . $auth . rawurlencode($config['unix_socket']) . $dababase; | ||
// @codeCoverageIgnoreEnd | ||
} else { | ||
// Basic => mongodb://127.0.0.1:27017 | ||
// mongodb://user:[email protected]:27017/dbname | ||
$command = 'mongodb://' . $auth . $config['host'] . ':' . $config['port'] . $dababase; | ||
} | ||
|
||
$this->mongo = new MongoServer($command); | ||
$this->concern = new WriteConcern(WriteConcern::MAJORITY, 1000); | ||
|
||
|
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
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
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 @@ | ||
php ../vendor/phpunit/phpunit/phpunit --configuration ../phpunit.xml --filter RedisTest ../tests/SimpleCache/Driver/RedisTest.php |