Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
a5a64dd7
Commit
a5a64dd7
authored
Aug 12, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved redis timeout handling
parent
133e5c6e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
RedisCache.php
framework/yii/caching/RedisCache.php
+7
-2
Connection.php
framework/yii/db/redis/Connection.php
+9
-2
No files found.
framework/yii/caching/RedisCache.php
View file @
a5a64dd7
...
...
@@ -63,7 +63,11 @@ class RedisCache extends Cache
/**
* @var float timeout to use for connection to redis. If not set the timeout set in php.ini will be used: ini_get("default_socket_timeout")
*/
public
$timeout
=
null
;
public
$connectionTimeout
=
null
;
/**
* @var float timeout to use for redis socket when reading and writing data. If not set the php default value will be used.
*/
public
$dataTimeout
=
null
;
/**
* @var \yii\db\redis\Connection the redis connection
*/
...
...
@@ -92,7 +96,8 @@ class RedisCache extends Cache
$this
->
_connection
=
new
Connection
(
array
(
'dsn'
=>
'redis://'
.
$this
->
hostname
.
':'
.
$this
->
port
.
'/'
.
$this
->
database
,
'password'
=>
$this
->
password
,
'timeout'
=>
$this
->
timeout
,
'connectionTimeout'
=>
$this
->
connectionTimeout
,
'dataTimeout'
=>
$this
->
dataTimeout
,
));
}
return
$this
->
_connection
;
...
...
framework/yii/db/redis/Connection.php
View file @
a5a64dd7
...
...
@@ -48,7 +48,11 @@ class Connection extends Component
/**
* @var float timeout to use for connection to redis. If not set the timeout set in php.ini will be used: ini_get("default_socket_timeout")
*/
public
$timeout
=
null
;
public
$connectionTimeout
=
null
;
/**
* @var float timeout to use for redis socket when reading and writing data. If not set the php default value will be used.
*/
public
$dataTimeout
=
null
;
/**
* @var array List of available redis commands http://redis.io/commands
...
...
@@ -245,9 +249,12 @@ class Connection extends Component
$host
,
$errorNumber
,
$errorDescription
,
$this
->
timeout
?
$this
->
t
imeout
:
ini_get
(
"default_socket_timeout"
)
$this
->
connectionTimeout
?
$this
->
connectionT
imeout
:
ini_get
(
"default_socket_timeout"
)
);
if
(
$this
->
_socket
)
{
if
(
$this
->
dataTimeout
!==
null
)
{
stream_set_timeout
(
$this
->
_socket
,
$timeout
=
(
int
)
$this
->
dataTimeout
,
(
int
)
((
$this
->
dataTimeout
-
$timeout
)
*
1000000
));
}
if
(
$this
->
password
!==
null
)
{
$this
->
executeCommand
(
'AUTH'
,
array
(
$this
->
password
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment