首页 > 其他 > 详细

resty的理解

时间:2020-03-01 11:53:24      阅读:43      评论:0      收藏:0      [点我收藏+]
无头的openresty,去掉了守护运行,把代码加载到
init_worker_by_lua directive处执行
run in the context of ngx.timer callback里面
resty --shdict=‘dogs 1m‘ -e ‘local dict = ngx.shared.dogs dict:set("Tom", 56) print(dict:get("Tom"))‘


time resty -e ‘local ths = {}
                 for i = 1, 3 do
                     ths[i] = ngx.thread.spawn(function ()
                                  ngx.sleep(3) ngx.say("done ", i)
                              end)
                 end
                 for i = 1, #ths do ngx.thread.wait(ths[i]) end‘
done 1
done 2
done 3

real 0m3.073s
user 0m0.053s
sys 0m0.015s
 

resty的理解

原文:https://www.cnblogs.com/justart/p/12388811.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!