#include 'protheus.ch'
#define STD_REDIS_PORT 6379
#define DEFAULT_REDIS_AUTH ""
// Setup Redis
Static cRedisHost := "localhost"
User Function WoAuth()
Local cMsg := ''
// Creation of client object
oRedisCli := tRedisClient():New()
// Connection to the server, using default port 6379
oRedisCli:Connect(cRedisHost, STD_REDIS_PORT)
If oRedisCli:lConnected
cMsg := "Successful connection to the server " + cRedisHost + ", at port "
cMsg += cValToChar(STD_REDIS_PORT) + ", with authentication '" + DEFAULT_REDIS_AUTH + "'"
ConOut(cMsg)
oRedisCli:Disconnect()
ConOut("The client 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. |