Added back memcached support for sessions
This commit is contained in:
parent
4b414783f0
commit
5ccdeb64a7
2 changed files with 42 additions and 2 deletions
|
@ -138,7 +138,7 @@ class Session extends Object
|
|||
|
||||
if (is_array($session))
|
||||
{
|
||||
if (isset($session['handler']) && in_array($session['handler'], array('files', 'mysql')))
|
||||
if (isset($session['handler']) && in_array($session['handler'], array('files', 'memcache', 'mysql')))
|
||||
{
|
||||
$this->handler = $session['handler'];
|
||||
|
||||
|
@ -162,6 +162,11 @@ class Session extends Object
|
|||
{
|
||||
$this->handler = 'files';
|
||||
}
|
||||
elseif ($session == 'memcache')
|
||||
{
|
||||
$this->handler = 'memcache';
|
||||
$datasource = 'memcache';
|
||||
}
|
||||
elseif ($session == 'mysql')
|
||||
{
|
||||
$this->handler = 'mysql';
|
||||
|
@ -176,6 +181,21 @@ class Session extends Object
|
|||
session_start();
|
||||
break;
|
||||
|
||||
case 'memcache':
|
||||
$hostname = 'localhost';
|
||||
$port = 11211;
|
||||
|
||||
if ($datasource !== false && isset($datasources[$datasource]))
|
||||
{
|
||||
$hostname = $datasources[$datasource]['hostname'];
|
||||
$port = $datasources[$datasource]['port'];
|
||||
}
|
||||
|
||||
ini_set('session.save_handler', 'memcache');
|
||||
ini_set('session.save_path', 'tcp://' . $hostname . ':' . $port . '?persistent=1&weight=1&timeout=1&retry_interval=15');
|
||||
session_start();
|
||||
break;
|
||||
|
||||
case 'mysql':
|
||||
if ($datasource !== false && isset($datasources[$datasource]))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue