local con1 = KEYS[4] or "" local con2 = KEYS[5] or "" local con3 = KEYS[6] or "" local att1 = KEYS[7] or "" local att2 = KEYS[8] or "" local att3 = KEYS[9] or "" local title = KEYS[10] or "" local content = KEYS[11] or "" local attachments = KEYS[12] or "" -- local roleInfo = redis.call("HGET", string.format("role:%d", KEYS[1]), "delete") -- if tonumber(roleInfo) == 1 then return end local id = redis.call("HINCRBY", string.format("role:%d:autoincr", KEYS[1]), "email", 1) redis.call("LPUSH", string.format("role:%d:emailIds", KEYS[1]), id) local deleteIds = redis.call("LRANGE", string.format("role:%d:emailIds", KEYS[1]), 50, -1) for _, deleteId in ipairs(deleteIds) do redis.call("DEL", string.format("email:%d:%d", KEYS[1], deleteId)) end redis.call("LTRIM", string.format("role:%d:emailIds", KEYS[1]), 0, 49) redis.call("HMSET", string.format("email:%d:%d", KEYS[1], id), "id", tostring(id), "emailId", KEYS[2], "status", "0", "createtime", KEYS[3], "con1", con1, "con2", con2, "con3", con3, "att1", att1, "att2", att2, "att3", att3, "title", title, "content", content, "attachments", attachments)