From 24e91311bd86b9eddb9ffb2d4b6ab78bf19796c2 Mon Sep 17 00:00:00 2001 From: tianhe1986 Date: Thu, 6 Jul 2017 09:25:01 +0800 Subject: Format fixing. Signed-off-by: tianhe1986 --- system/libraries/Session/drivers/Session_memcached_driver.php | 7 ++----- system/libraries/Session/drivers/Session_redis_driver.php | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'system/libraries/Session') diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php index 8c01a8783..5e90539d7 100644 --- a/system/libraries/Session/drivers/Session_memcached_driver.php +++ b/system/libraries/Session/drivers/Session_memcached_driver.php @@ -326,11 +326,8 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa continue; } - $result = ($this->_memcached->getResultCode() === Memcached::RES_NOTFOUND) - ? $this->_memcached->add($lock_key, time(), 300) - : $this->_memcached->set($lock_key, time(), 300); - - if ( ! $result) + $method = ($this->_memcached->getResultCode() === Memcached::RES_NOTFOUND) ? 'add' : 'set'; + if ( ! $this->_memcached->$method($lock_key, time(), 300)) { 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 3437898de..76bddffd3 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -368,6 +368,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle $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); -- cgit v1.2.3-24-g4f1b