选择语言 :

 Module_Storage_Driver_Swift::connection

返回连接对象

resource Module_Storage_Driver_Swift::connection( )
返回值
  • resource
File: ./modules/storage/driver/swift.class.php
protected function connection($re_connect=false)
{
    # 更新token
    $this->get_token();

    $connection_hash = $this->get_connection_hash();

    if (!$re_connect && !isset(Storage_Driver_Swift::$connections[$connection_hash]))
    {
        $fp = $this->fp($this->storage_protocol, $this->storage_host, $this->storage_port, $this->timeout);

        Storage_Driver_Swift::set_connection($connection_hash, $fp);
    }
    else if ($re_connect || (isset(Storage_Driver_Swift::$last_used[$this->storage_host]) && time()-Storage_Driver_Swift::$last_used[$this->storage_host] >= $this->timeout))
    {
        # 超时的连接,销毁后重新连接
        Storage_Driver_Swift::unset_connection($connection_hash);

        return $this->connection($re_connect);
    }

    return Storage_Driver_Swift::$connections[$connection_hash];
}