lua redis handles errors… here is a solution to the problem.
lua redis handles errors
I use a lua script to set the key for redis:
local redis = require("redis")
local connected, client = pcall(redis.connect, '127.0.0.1', 6379)
client:set(key, value)
Sometimes, when I execute :client:set(key, value), I get an error: connection timed out and the application crashes.
How do I deal with this error issue?
Solution
Workaround:
local status, result = pcall(function() client:set(key, value) end)