1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/iresty-lua-var-nginx-module

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
Внести вклад в разработку кода
Синхронизировать код
Отмена
Подсказка: Поскольку Git не поддерживает пустые директории, создание директории приведёт к созданию пустого файла .keep.
Loading...
README.md

lua-var-nginx-module

Fetchs Nginx variable by Luajit with FFI way which is fast and cheap.

Compares to ngx.var.*, performance has increased by more than five times. ^_^

Table of Contents

Install

Compiles the nginx c module to OpenResty:

./configure --prefix=/opt/openresty \
         --add-module=/path/to/lua-var-nginx-module

Install the Lua source code, there are two ways:

luarocks install lua-resty-ngxvar

Or we can copy the source lua file to specified directory which OpenResty can load it normally.

make install LUA_LIB_DIR=/opt/openresty/lualib/

Method

request

syntax: req = ngxvar.request()

Returns the request object of current request. We can cache it at your Lua code land if we try to fetch more than one variable in one request.

Back to TOC

fetch

syntax: val = ngxvar.fetch(name, req)

Returns the Nginx variable value by name.

 location /t {
     content_by_lua_block {
         local var = require("resty.ngxvar")
         local req = var.request()

         ngx.say(var.fetch("host", req))
         ngx.say(var.fetch("uri", req))
     }
 }

Back to TOC

TODO

  • support more variables.

Back to TOC

Комментарии ( 0 )

Вы можете оставить комментарий после Вход в систему

Введение

Извлекает переменную Nginx с помощью Luajit способом FFI, который является быстрым и экономичным. Развернуть Свернуть
Apache-2.0
Отмена

Обновления

Пока нет обновлений

Участники

все

Недавние действия

Загрузить больше
Больше нет результатов для загрузки
1
https://api.gitlife.ru/oschina-mirror/iresty-lua-var-nginx-module.git
git@api.gitlife.ru:oschina-mirror/iresty-lua-var-nginx-module.git
oschina-mirror
iresty-lua-var-nginx-module
iresty-lua-var-nginx-module
master