aLiLua:一个lua web 框架
By youbbs
at 2015-07-21 16:47 • 3511次点击
aLiLua 是一套基于 epoll/kqueue/Lua 构建的网络服务开发框架 aLiLua 使用 epoll 进行网络/文件IO事件读写,对Lua协程进行调度,其性能高效并且简单
http://alilua.com/ 18 https://github.com/oneoo/alilua 13
example
local db = mysql:new()
local db_ok, err, errno, sqlstate = db:connect({
host = "localhost",
port = 3306,
pool_size = 256,
database = "db",
user = "user",
password = "***"})
if not db_ok then
header('HTTP/1.1 503 ServerError')
die('MySQL Connection Error.')
end
local res, err, errno, sqlstate = db:query("SELECT * FROM t1 LIMIT 1")
if not res then
echo("bad result: ", err, ": ", errno, ": ", sqlstate, ".")
else
echo("result: ", json_encode(res)..'\n')
end
请 登录 后发表评论