summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authortianhe1986 <w1s2j3229@163.com>2017-07-05 13:42:49 +0200
committertianhe1986 <w1s2j3229@163.com>2017-07-05 13:42:49 +0200
commit3eecd968bd68cf3c70baa81be332b2007a14e564 (patch)
treed2b9573abe6fc0e02f7fc1fe8db5cd1fcc94c88a /system
parente98c203f81a11cfd82a644381cd50f865384118d (diff)
Simplifying the code.
Signed-off-by: tianhe1986 <w1s2j3229@163.com>
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Session/drivers/Session_memcached_driver.php4
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php14
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;