import.css=/download/attachments/6062824/tecnologia.css |
Cria um interface de acesso ao Redis, que é um gerenciador de armazenamento do tipo chave-valor. Seus usos típicos incluem message brokers (ou tratador de mensagens) ou cache de bancos de dados.
#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. |
Para Windows a versão requer uma biblioteca para acesso ao Redis (rdwincli.dll).
Arquivos: rdwincli_32bits.zip | rdwincli_64bits.zip
Totvs Application Server com release superior a 7.00.131227A-20160120 NG