documented the init_worker_by_lua_block {} directive.
This commit is contained in:
Родитель
8daa9a672c
Коммит
def5d55008
|
@ -1070,6 +1070,7 @@ Directives
|
|||
* [init_by_lua_block](#init_by_lua_block)
|
||||
* [init_by_lua_file](#init_by_lua_file)
|
||||
* [init_worker_by_lua](#init_worker_by_lua)
|
||||
* [init_worker_by_lua_block](#init_worker_by_lua_block)
|
||||
* [init_worker_by_lua_file](#init_worker_by_lua_file)
|
||||
* [set_by_lua](#set_by_lua)
|
||||
* [set_by_lua_block](#set_by_lua_block)
|
||||
|
@ -1328,7 +1329,7 @@ For instance,
|
|||
```nginx
|
||||
|
||||
init_by_lua_block {
|
||||
print("I need no extra escapings here, for example: \r\nblah")
|
||||
print("I need no extra escaping here, for example: \r\nblah")
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -1362,9 +1363,11 @@ init_worker_by_lua
|
|||
|
||||
**phase:** *starting-worker*
|
||||
|
||||
**WARNING** Since the `v0.9.17` release, use of this directive is *discouraged*; use the new [init_worker_by_lua_block](#init_worker_by_lua_block) directive instead.
|
||||
|
||||
Runs the specified Lua code upon every Nginx worker process's startup when the master process is enabled. When the master process is disabled, this hook will just run after [init_by_lua*](#init_by_lua).
|
||||
|
||||
This hook is often used to create per-worker reoccurring timers (via the [ngx.timer.at](#ngxtimerat) Lua API), either for backend healthcheck or other timed routine work. Below is an example,
|
||||
This hook is often used to create per-worker reoccurring timers (via the [ngx.timer.at](#ngxtimerat) Lua API), either for backend health-check or other timed routine work. Below is an example,
|
||||
|
||||
```nginx
|
||||
|
||||
|
@ -1398,6 +1401,33 @@ This directive was first introduced in the `v0.9.5` release.
|
|||
|
||||
[Back to TOC](#directives)
|
||||
|
||||
init_worker_by_lua_block
|
||||
------------------------
|
||||
|
||||
**syntax:** *init_worker_by_lua_block { lua-script }*
|
||||
|
||||
**context:** *http*
|
||||
|
||||
**phase:** *starting-worker*
|
||||
|
||||
Similar to the [init_worker_by_lua](#init_worker_by_lua) directive except that this directive inlines
|
||||
the Lua source directly
|
||||
inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
|
||||
special character escaping).
|
||||
|
||||
For instance,
|
||||
|
||||
```nginx
|
||||
|
||||
init_worker_by_lua_block {
|
||||
print("I need no extra escaping here, for example: \r\nblah")
|
||||
}
|
||||
```
|
||||
|
||||
This directive was first introduced in the `v0.9.17` release.
|
||||
|
||||
[Back to TOC](#directives)
|
||||
|
||||
init_worker_by_lua_file
|
||||
-----------------------
|
||||
|
||||
|
|
|
@ -1074,7 +1074,7 @@ For instance,
|
|||
|
||||
<geshi lang="nginx">
|
||||
init_by_lua_block {
|
||||
print("I need no extra escapings here, for example: \r\nblah")
|
||||
print("I need no extra escaping here, for example: \r\nblah")
|
||||
}
|
||||
</geshi>
|
||||
|
||||
|
@ -1102,9 +1102,11 @@ This directive was first introduced in the <code>v0.5.5</code> release.
|
|||
|
||||
'''phase:''' ''starting-worker''
|
||||
|
||||
'''WARNING''' Since the <code>v0.9.17</code> release, use of this directive is ''discouraged''; use the new [[#init_worker_by_lua_block|init_worker_by_lua_block]] directive instead.
|
||||
|
||||
Runs the specified Lua code upon every Nginx worker process's startup when the master process is enabled. When the master process is disabled, this hook will just run after [[#init_by_lua|init_by_lua*]].
|
||||
|
||||
This hook is often used to create per-worker reoccurring timers (via the [[#ngx.timer.at|ngx.timer.at]] Lua API), either for backend healthcheck or other timed routine work. Below is an example,
|
||||
This hook is often used to create per-worker reoccurring timers (via the [[#ngx.timer.at|ngx.timer.at]] Lua API), either for backend health-check or other timed routine work. Below is an example,
|
||||
|
||||
<geshi lang="nginx">
|
||||
init_worker_by_lua '
|
||||
|
@ -1135,6 +1137,29 @@ This hook is often used to create per-worker reoccurring timers (via the [[#ngx.
|
|||
|
||||
This directive was first introduced in the <code>v0.9.5</code> release.
|
||||
|
||||
== init_worker_by_lua_block ==
|
||||
|
||||
'''syntax:''' ''init_worker_by_lua_block { lua-script }''
|
||||
|
||||
'''context:''' ''http''
|
||||
|
||||
'''phase:''' ''starting-worker''
|
||||
|
||||
Similar to the [[#init_worker_by_lua|init_worker_by_lua]] directive except that this directive inlines
|
||||
the Lua source directly
|
||||
inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
|
||||
special character escaping).
|
||||
|
||||
For instance,
|
||||
|
||||
<geshi lang="nginx">
|
||||
init_worker_by_lua_block {
|
||||
print("I need no extra escaping here, for example: \r\nblah")
|
||||
}
|
||||
</geshi>
|
||||
|
||||
This directive was first introduced in the <code>v0.9.17</code> release.
|
||||
|
||||
== init_worker_by_lua_file ==
|
||||
|
||||
'''syntax:''' ''init_worker_by_lua_file <lua-file-path>''
|
||||
|
|
Загрузка…
Ссылка в новой задаче