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
8beadc91
Commit
8beadc91
authored
Aug 24, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup MemCache timeout API after #804
use milliseconds only and fall back to seconds for older memcache versions.
parent
5311dac9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
12 deletions
+15
-12
MemCache.php
framework/yii/caching/MemCache.php
+7
-2
MemCacheServer.php
framework/yii/caching/MemCacheServer.php
+8
-10
No files found.
framework/yii/caching/MemCache.php
View file @
8beadc91
...
...
@@ -93,8 +93,13 @@ class MemCache extends Cache
if
(
$this
->
useMemcached
)
{
$cache
->
addServer
(
$server
->
host
,
$server
->
port
,
$server
->
weight
);
}
else
{
$cache
->
addServer
(
$server
->
host
,
$server
->
port
,
$server
->
persistent
,
$server
->
weight
,
$server
->
timeout
,
$server
->
retryInterval
,
$server
->
status
,
$server
->
failureCallback
,
$server
->
timemoutms
);
// $timeout is used for memcache versions that do not have timeoutms parameter
$timeout
=
(
int
)
(
$server
->
timeout
/
1000
)
+
((
$server
->
timeout
%
1000
>
0
)
?
1
:
0
);
$cache
->
addServer
(
$server
->
host
,
$server
->
port
,
$server
->
persistent
,
$server
->
weight
,
$timeout
,
$server
->
retryInterval
,
$server
->
status
,
$server
->
failureCallback
,
$server
->
timeout
);
}
}
}
else
{
...
...
framework/yii/caching/MemCacheServer.php
View file @
8beadc91
...
...
@@ -35,9 +35,11 @@ class MemCacheServer extends \yii\base\Object
*/
public
$persistent
=
true
;
/**
* @var integer value in seconds which will be used for connecting to the server. This is used by memcache only.
* @var integer timeout in milliseconds which will be used for connecting to the server.
* This is used by memcache only. For old versions of memcache that only support specifying
* timeout in seconds this will be rounded up to full seconds.
*/
public
$timeout
=
1
;
public
$timeout
=
1
000
;
/**
* @var integer how often a failed server will be retried (in seconds). This is used by memcache only.
*/
...
...
@@ -47,14 +49,10 @@ class MemCacheServer extends \yii\base\Object
*/
public
$status
=
true
;
/**
* @var \Closure
allows the user to specify a callback function to
run upon encountering an error.
* The callback is run before fail
over is attempted. The function takes
two parameters,
* @var \Closure
this callback function will
run upon encountering an error.
* The callback is run before fail
over is attempted. The function takes
two parameters,
* the [[host]] and the [[port]] of the failed server.
* This is used by memcache only.
*/
public
$failureCallback
=
null
;
/**
* @var integer value in milliseconds which will be used for connecting to the server.
* Takes precedence over [[timeout]]. This is used by memcache only.
*/
public
$timemoutms
=
1000
;
public
$failureCallback
;
}
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