DEPRECADO

O método ::Ok() não deve ser usado, pois foi substituído pela propriedade ::lOk.


Sintaxe

lResult := oRedisClient::Ok()

Parâmetros

O método ::Ok() não usa nenhum parâmetro.

Retorno

NomeTipoDescriçãoObservações
lResultlógicoVerdadeiro (.T.) a última operação do objeto tRedisClient tenha sido verdadeira; .F. em caso contrário.



Observações

  • O método ::Ok() não deve ser usado, pois foi substituído pela propriedade ::lOk.
  • O método ::Ok() será eliminado em futuras versões da classe tRedisConnect.

Exemplos

Exemplo 1 – Teste de ::Ok() depois de tentativa de conexão 

#include 'protheus.ch'
 
// Setup Redis
Static cRedisHost := "localhost"
Static nRedisPort := 6379
Static cRedisAuth := ""
 
User Function tstOk()
 Local cMsg := ''
 
 oRedisClient := tRedisClient():New()
 ConOut( "Result of ::ok() after ::New(): " + cValToChar(oRedisClient:Ok()) )
 
 oRedisClient:Connect(cRedisHost, nRedisPort, cRedisAuth)
 ConOut("Result of ::ok() after ::Connect(): " + cValToChar(oRedisClient:Ok()) )
 
 If oRedisClient:lConnected
 ConOut("Successful connection.")
 
 oRedisClient:Disconnect()
 ConOut("The client disconnected from the server.")
 ConOut("Result of ::ok() after ::Disconnect(): " + cValToChar(oRedisClient:Ok()) )
 Return .T.
 EndIf
 
 cMsg := "Could not connect to the server " + cRedisHost + ", at port "
 cMsg += cValToChar(nRedisPort) + ", with authentication '" + cRedisAuth + "'"
 ConOut(cMsg)
 
Return .F.