diff options
author | Andrey Andreev <narf@devilix.net> | 2016-12-01 13:14:18 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-12-01 13:14:18 +0100 |
commit | 9e829e10e6f2d3786c358ca6c8c3ba2a149a6a40 (patch) | |
tree | c38faf49e7274c3edfdb5ebb59ce80ac35fe57d8 /system/libraries/Session/drivers/Session_redis_driver.php | |
parent | efd856edce0b952c8a7a62ec953ae1baee77ff34 (diff) | |
parent | 8db01f13809a92bac7bc95b02893175d7654d627 (diff) |
Merge branch '3.1-stable' into develop
Diffstat (limited to 'system/libraries/Session/drivers/Session_redis_driver.php')
-rw-r--r-- | system/libraries/Session/drivers/Session_redis_driver.php | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php index 592f1ff6c..233b15619 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -223,7 +223,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle */ public function write($session_id, $session_data) { - if ( ! isset($this->_redis)) + if ( ! isset($this->_redis, $this->_lock_key)) { return $this->_fail(); } @@ -239,27 +239,22 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle $this->_session_id = $session_id; } - if (isset($this->_lock_key)) + $this->_redis->setTimeout($this->_lock_key, 300); + if ($this->_fingerprint !== ($fingerprint = md5($session_data)) OR $this->_key_exists === FALSE) { - $this->_redis->setTimeout($this->_lock_key, 300); - if ($this->_fingerprint !== ($fingerprint = md5($session_data)) OR $this->_key_exists === FALSE) + if ($this->_redis->set($this->_key_prefix.$session_id, $session_data, $this->_config['expiration'])) { - if ($this->_redis->set($this->_key_prefix.$session_id, $session_data, $this->_config['expiration'])) - { - $this->_fingerprint = $fingerprint; - $this->_key_exists = TRUE; - return $this->_success; - } - - return $this->_fail(); + $this->_fingerprint = $fingerprint; + $this->_key_exists = TRUE; + return $this->_success; } - return ($this->_redis->setTimeout($this->_key_prefix.$session_id, $this->_config['expiration'])) - ? $this->_success - : $this->_fail(); + return $this->_fail(); } - return $this->_fail(); + return ($this->_redis->setTimeout($this->_key_prefix.$session_id, $this->_config['expiration'])) + ? $this->_success + : $this->_fail(); } // ------------------------------------------------------------------------ |