當前位置:
首頁 >
openresty总结
發布時間:2025/3/15
36
豆豆
生活随笔
收集整理的這篇文章主要介紹了
openresty总结
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
協程
1.例如當獲取的數據沒有前后依賴關系時,可以使用ngx.thread.spawn和ngx.thread.wait同時從數據庫不同的庫、表或者不同來源(mysql,redis等)獲取數據。
https://github.com/openresty/lua-nginx-module#ngxthreadspawn
https://github.com/openresty/lua-nginx-module#ngxthreadwait
2.假如從不同的location獲取數據時,可以使用ngx.location.capture_multi并發獲取
3.ngx.ctx.foo中變量foo可以跨越一個請求的多個階段(rewrite,access,content等),但是子請求擁有獨立的ngx.ctx表,并不共享。ngx.location.capture中附加的參數中添加{ctx = ngx.ctx},可設置為父子請求共享同一個 ngx.ctx 表。
轉載于:https://www.cnblogs.com/mentalidade/p/7207559.html
總結
以上是生活随笔為你收集整理的openresty总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: freeCodeCamp:Diff Tw
- 下一篇: jQuery基本知识