summaryrefslogtreecommitdiffstats
path: root/system/libraries/Session/drivers/Session_redis_driver.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Session/drivers/Session_redis_driver.php')
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index 2aeb77267..8fc0a45da 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -365,7 +365,16 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
continue;
}
- if ( ! $this->_redis->setex($lock_key, 300, time()))
+ 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)
{
log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id);
return FALSE;