예제 #1
0
 /**
  * Get connection by channel name
  * 
  * @param string $name Channel name
  * @return Rediska_Connection
  */
 public function getConnectionByChannelName($name)
 {
     // Get connection
     if ($this->_specifiedConnection) {
         $connection = $this->_specifiedConnection;
     } else {
         $connection = $this->_channel->getRediska()->getConnectionByKeyName($name);
     }
     if (!array_key_exists($connection->getAlias(), self::$_allConnections)) {
         self::$_allConnections[$connection->getAlias()] = clone $connection;
         self::$_allConnections[$connection->getAlias()]->setBlockingMode(false);
     }
     $connection = self::$_allConnections[$connection->getAlias()];
     return $connection;
 }
예제 #2
0
 /**
  * Get connection by channel name
  * 
  * @param string $name Channel name
  * @return Rediska_Connection
  */
 public function getConnectionByChannelName($name)
 {
     // Get connection
     if ($this->_specifiedConnection) {
         $connection = $this->_specifiedConnection;
     } else {
         $connection = $this->_channel->getRediska()->getConnectionByKeyName($name);
     }
     if (!array_key_exists($connection->getAlias(), $this->_connections)) {
         $this->_connections[$connection->getAlias()] = clone $connection;
         // If more than one - move to non blocking mode
         if (count($this->_connections) > 1) {
             foreach ($this->_connections as $connection) {
                 if ($connection->getOption('blockingMode')) {
                     $connection->setOption('blockingMode', false);
                 }
             }
         }
     }
     $connection = $this->_connections[$connection->getAlias()];
     return $connection;
 }