diff options
-rw-r--r-- | system/libraries/Session/drivers/Session_memcached_driver.php | 4 | ||||
-rw-r--r-- | system/libraries/Session/drivers/Session_redis_driver.php | 14 |
2 files changed, 6 insertions, 12 deletions
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php index 542f596c9..8c01a8783 100644 --- a/system/libraries/Session/drivers/Session_memcached_driver.php +++ b/system/libraries/Session/drivers/Session_memcached_driver.php @@ -326,11 +326,11 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa continue; } - $set_result = ($this->_memcached->getResultCode() === Memcached::RES_NOTFOUND) + $result = ($this->_memcached->getResultCode() === Memcached::RES_NOTFOUND) ? $this->_memcached->add($lock_key, time(), 300) : $this->_memcached->set($lock_key, time(), 300); - if ( ! $set_result) + if ( ! $result) { log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id); return FALSE; diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php index 8fc0a45da..3437898de 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -365,16 +365,10 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle continue; } - if ($ttl === -2) - { - $set_result = $this->_redis->set($lock_key, time(), array('nx', 'ex' => 300)); - } - else - { - $set_result = $this->_redis->setex($lock_key, 300, time()); - } - - if ( ! $set_result) + $result = ($ttl === -2) + ? $this->_redis->set($lock_key, time(), array('nx', 'ex' => 300)) + : $this->_redis->setex($lock_key, 300, time()); + if ( ! $result) { log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id); return FALSE; |