Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark authored Oct 7, 2024
1 parent e2fd687 commit ac1b7b7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions framework/caching/CRedisCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CRedisCache extends CCache
* @var int the port to use for connecting to the redis server. Default port is 6379.
*/
public $port=6379;
/**
/**
* @var string the username to use to authenticate with the redis server. If set, AUTH command will be sent with username.
*/
public $username;
Expand Down Expand Up @@ -101,11 +101,12 @@ protected function connect()
{
if($this->ssl)
stream_socket_enable_crypto($this->_socket,true,STREAM_CRYPTO_METHOD_TLS_CLIENT);
if($this->password!==null){
if($this->username!==null)
if ($this->password !== null) {
if ($this->username !== null) {
$this->executeCommand('AUTH',array($this->username, $this->password));
else
} else {
$this->executeCommand('AUTH',array($this->password));
}
}

$this->executeCommand('SELECT',array($this->database));
Expand Down

0 comments on commit ac1b7b7

Please sign in to comment.