Histórico da Página
Desconecta o cliente do servidor
Sintaxe
Bloco de código |
---|
oReisdClient:Disconnect() |
Observações
O método ::Disconnect()
permite que um cliente interrompa sua conexão com um servidor Redis. Isto permite que sejam liberados recursos alocados para conexão tanto no servidor quanto no cliente.
Deste modo, o servidor Redis pode atender a outros clientes.
Naturalmente, uma desconexão só faz sentido caso o cliente tenha de fato conseguido se conectar.
Exemplos
Bloco de código | ||
---|---|---|
| ||
#include 'protheus.ch' #define STD_REDIS_PORT 6379 #define DEFAULT_REDIS_AUTH "" // Setup Redis Static cRedisHost := "tec-climalocalhost" Static nRedisPort User := 6379 Static cRedisAuthFunction WoAuth() Local cMsg := ""'' User Function redTst() // Creation of client object oRedisCli := tRedisClient():New() // Connection to the server, using default port 6379 oRedisCli:Connect(cRedisHost, nRedisPort, cRedisAuthSTD_REDIS_PORT) If oRedisCli:lConnected) cMsg := ConOut("Successful connection." to the server " + cRedisHost + ", at port " cMsg += cValToChar(STD_REDIS_PORT) + ", with authentication '" + DEFAULT_REDIS_AUTH + "'" ConOut(cMsg) oRdClientoRedisCli:Disconnect() ConOut("The client was disconnected from the server.") Return .T. EndIf cMsg := "Could not connect to the server " + cRedisHost + ", at port " cMsg += cValToChar(STD_REDIS_PORT) + ", with authentication '" + DEFAULT_REDIS_AUTH + "'" ConOut(cMsg) Return .F. |
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas