Histórico da Página
...
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#include 'protheus.ch'
User Function execSet()
Local retVal := Nil
Local cCommand := ''
Local cMsg := ''
Local oRedisClient := Nil
oRedisClient := tRedisClient():New()
// Setup Redis connection
oRedisClient:Connect("tec-clima", 6379, "")
If .Not. oRedisClient:lConnected
ConOut("Could not connect to Redis server")
Return .F.
EndIf
// Set the field 'x' to the value 'aaa'
cCommand := 'set x "aaa"'
oRedisClient:Exec(cCommand, @retVal)
// If the execution wasn't fine
If .Not. oRedisClient:lOk
ConOut("Could not Exec(" + cCommand + ")")
VarInfo("State of object: ", oRedisClient)
oRdClient:Disconnect()
Return .F.
EndIf
ConOut("Successful Exec('" + cCommand + "')")
If ValType(retVal) != 'C'
cMsg := cValToChar(retVal)
Else
cMsg := retVal
EndIf
ConOut("Exec() result: " + cMsg)
VarInfo("State of the object: ", oRedisClient)
oRedisClient:Disconnect()
Return .T. |
Observações
Para Windows a versão requer uma biblioteca para acesso ao Redis (rdwincli.dll).
...
Visão Geral
Import HTML Content
Conteúdo das Ferramentas