Skip to content

Commit bb0cd7c

Browse files
hugh-leecebe
authored andcommitted
add socketClientFlags
close #31
1 parent 1cb19d1 commit bb0cd7c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Yii Framework 2 redis extension Change Log
77
- Bug #22: Fixed string escaping issue in LuaScriptBuilder (vistart)
88
- Bug #37: Fixed detection of open socket (mirocow)
99
- Bug #46: Fixed bug to execute session_regenerate_id in PHP 7.0 (githubjeka)
10+
- Enh #31: Added `Connection::$socketClientFlags` property for connection flags to be passed to `stream_socket_client()` (hugh-lee)
1011
- Chg #14: Added missing `BLPOP` to `$redisCommands` (samdark)
1112

1213
2.0.4 May 10, 2015

Connection.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ class Connection extends Component
7676
* @var float timeout to use for redis socket when reading and writing data. If not set the php default value will be used.
7777
*/
7878
public $dataTimeout = null;
79+
/**
80+
* @var integer Bitmask field which may be set to any combination of connection flags passed to [stream_socket_client()](http://php.net/manual/en/function.stream-socket-client.php).
81+
* Currently the select of connection flags is limited to `STREAM_CLIENT_CONNECT` (default), `STREAM_CLIENT_ASYNC_CONNECT` and `STREAM_CLIENT_PERSISTENT`.
82+
* @see http://php.net/manual/en/function.stream-socket-client.php
83+
* @since 2.0.5
84+
*/
85+
public $socketClientFlags = STREAM_CLIENT_CONNECT;
7986
/**
8087
* @var array List of available redis commands http://redis.io/commands
8188
*/
@@ -263,7 +270,8 @@ public function open()
263270
$this->unixSocket ? 'unix://' . $this->unixSocket : 'tcp://' . $this->hostname . ':' . $this->port,
264271
$errorNumber,
265272
$errorDescription,
266-
$this->connectionTimeout ? $this->connectionTimeout : ini_get("default_socket_timeout")
273+
$this->connectionTimeout ? $this->connectionTimeout : ini_get("default_socket_timeout"),
274+
$this->socketClientFlags
267275
);
268276
if ($this->_socket) {
269277
if ($this->dataTimeout !== null) {

0 commit comments

Comments
 (0)