diff options
Diffstat (limited to 'system/libraries/Session/drivers/Session_redis_driver.php')
-rw-r--r-- | system/libraries/Session/drivers/Session_redis_driver.php | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php index 3ee59a4a2..ea70e4946 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -281,7 +281,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle $this->_session_id = $session_id; } - $this->_setTimeout($this->_lock_key, 300); + $this->_redis->{$this->_setTimeout_name}($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'])) @@ -294,7 +294,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle return $this->_fail(); } - return ($this->_setTimeout($this->_key_prefix.$session_id, $this->_config['expiration'])) + return ($this->_redis->{$this->_setTimeout_name}($this->_key_prefix.$session_id, $this->_config['expiration'])) ? $this->_success : $this->_fail(); } @@ -313,8 +313,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle if (isset($this->_redis)) { try { - $ping = $this->_redis->ping(); - if ($ping === $this->_ping_response) + if ($this->_redis->ping() === $this->_ping_response) { $this->_release_lock(); if ($this->_redis->close() === FALSE) @@ -349,7 +348,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle { if (isset($this->_redis, $this->_lock_key)) { - if (($result = $this->_delete($this->_key_prefix.$session_id)) !== 1) + if (($result = $this->_redis->{$this->_delete_name}($this->_key_prefix.$session_id)) !== 1) { log_message('debug', 'Session: Redis::'.$this->_delete_name.'() expected to return 1, got '.var_export($result, TRUE).' instead.'); } @@ -410,7 +409,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle // correct session ID. if ($this->_lock_key === $this->_key_prefix.$session_id.':lock') { - return $this->_setTimeout($this->_lock_key, 300); + return $this->_redis->{$this->_setTimeout_name}($this->_lock_key, 300); } // 30 attempts to obtain a lock, in case another request already has it @@ -468,7 +467,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle { if (isset($this->_redis, $this->_lock_key) && $this->_lock) { - if ( ! $this->_delete($this->_lock_key)) + if ( ! $this->_redis->{$this->_delete_name}($this->_lock_key)) { log_message('error', 'Session: Error while trying to free lock for '.$this->_lock_key); return FALSE; @@ -481,35 +480,4 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle return TRUE; } - // ------------------------------------------------------------------------ - - /** - * Set timeout - * - * Sets expiration for a key - * - * @param string $key Redis key - * @param int $ttl The key's remaining Time To Live, in seconds. - * @return bool - */ - protected function _setTimeout($key, $ttl) - { - return $this->_redis->{$this->_setTimeout_name}($key, $ttl); - } - - // ------------------------------------------------------------------------ - - /** - * Delete - * - * Deletes a key - * - * @param string $key Redis key - * @return bool - */ - protected function _delete($key) - { - return $this->_redis->{$this->_delete_name}($key); - } - } |