API ReferenceUtilities
Ping
Test the Redis connection
Syntax
Redix.Ping(callback)Parameters
Prop
Type
Returns
Prop
Type
Examples
-- Simple ping
Redix.Ping(function(err, response)
if not err and response == 'PONG' then
print('Redis is connected')
else
print('Redis connection failed')
end
end)
-- Health check on resource start
AddEventHandler('onResourceStart', function(resourceName)
if GetCurrentResourceName() == resourceName then
Redix.Ping(function(err, response)
if response == 'PONG' then
print('^2[Redix] Connection successful^7')
else
print('^1[Redix] Connection failed^7')
end
end)
end
end)Use Cases
Periodic Health Check
CreateThread(function()
while true do
Wait(60000) -- Every minute
Redix.Ping(function(err, response)
if err or response ~= 'PONG' then
print('^1[Warning] Redis connection lost^7')
-- Attempt reconnection or alert admins
end
end)
end
end)