updated the docs for ngx.req.start_time and ngx.now a bit.
This commit is contained in:
Родитель
4a4bdd9506
Коммит
614d6a6ef0
52
README
52
README
|
@ -2117,6 +2117,24 @@ Nginx API for Lua
|
|||
For reading *request* headers, use the ngx.req.get_headers function
|
||||
instead.
|
||||
|
||||
ngx.req.start_time
|
||||
syntax: *secs = ngx.req.start_time()*
|
||||
|
||||
context: *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*,
|
||||
header_filter_by_lua*, body_filter_by_lua*, log_by_lua**
|
||||
|
||||
Returns a floating-point number representing the timestamp (including
|
||||
milliseconds as the decimal part) when the current request was created.
|
||||
|
||||
The following example emulates the $request_time variable value
|
||||
(provided by [[HttpLogModule]]) in pure Lua:
|
||||
|
||||
local request_time = ngx.now() - ngx.req.start_time()
|
||||
|
||||
This function was first introduced in the "v0.7.7" release.
|
||||
|
||||
See also ngx.now and ngx.update_time.
|
||||
|
||||
ngx.req.get_method
|
||||
syntax: *method_name = ngx.req.get_method()*
|
||||
|
||||
|
@ -2523,6 +2541,15 @@ Nginx API for Lua
|
|||
|
||||
ngx.req.clear_header("X-Foo")
|
||||
|
||||
ngx.req.clear_header
|
||||
syntax: *ngx.req.clear_header(header_name)*
|
||||
|
||||
context: *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*,
|
||||
header_filter_by_lua*, body_filter_by_lua**
|
||||
|
||||
Clear the current request's request header named "header_name". None of
|
||||
the current request's subrequests will be affected.
|
||||
|
||||
ngx.req.read_body
|
||||
syntax: *ngx.req.read_body()*
|
||||
|
||||
|
@ -2816,15 +2843,6 @@ Nginx API for Lua
|
|||
|
||||
This function was first introduced in the "v0.5.0rc1" release.
|
||||
|
||||
ngx.req.clear_header
|
||||
syntax: *ngx.req.clear_header(header_name)*
|
||||
|
||||
context: *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*,
|
||||
header_filter_by_lua*, body_filter_by_lua**
|
||||
|
||||
Clear the current request's request header named "header_name". None of
|
||||
the current request's subrequests will be affected.
|
||||
|
||||
ngx.exec
|
||||
syntax: *ngx.exec(uri, args?)*
|
||||
|
||||
|
@ -3392,8 +3410,8 @@ Nginx API for Lua
|
|||
current time stamp from the nginx cached time (no syscall involved
|
||||
unlike Lua's date library).
|
||||
|
||||
Use the Nginx core timer_resolution directive to adjust the accuracy or
|
||||
forcibly update the Nginx time cache by calling ngx.update_time first.
|
||||
You can forcibly update the Nginx time cache by calling ngx.update_time
|
||||
first.
|
||||
|
||||
This API was first introduced in "v0.3.1rc32".
|
||||
|
||||
|
@ -3472,18 +3490,6 @@ Nginx API for Lua
|
|||
...
|
||||
end
|
||||
|
||||
ngx.req.start_time
|
||||
syntax: *secs = ngx.req.start_time()*
|
||||
|
||||
context: *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*,
|
||||
header_filter_by_lua*, body_filter_by_lua*, log_by_lua**
|
||||
|
||||
Returns a floating-point number representing the timestamp (including
|
||||
milliseconds as the decimal part) when the current request was created.
|
||||
|
||||
The following example is similar to $request_time in Nginx log module :
|
||||
local request_time = ngx.now() - ngx.req.start_time()
|
||||
|
||||
ngx.is_subrequest
|
||||
syntax: *value = ngx.is_subrequest*
|
||||
|
||||
|
|
|
@ -1939,6 +1939,24 @@ Note that `ngx.header` is not a normal Lua table and as such, it is not possible
|
|||
|
||||
For reading *request* headers, use the [ngx.req.get_headers](http://wiki.nginx.org/HttpLuaModule#ngx.req.get_headers) function instead.
|
||||
|
||||
ngx.req.start_time
|
||||
------------------
|
||||
**syntax:** *secs = ngx.req.start_time()*
|
||||
|
||||
**context:** *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua**
|
||||
|
||||
Returns a floating-point number representing the timestamp (including milliseconds as the decimal part) when the current request was created.
|
||||
|
||||
The following example emulates the `$request_time` variable value (provided by [HttpLogModule](http://wiki.nginx.org/HttpLogModule)) in pure Lua:
|
||||
|
||||
|
||||
local request_time = ngx.now() - ngx.req.start_time()
|
||||
|
||||
|
||||
This function was first introduced in the `v0.7.7` release.
|
||||
|
||||
See also [ngx.now](http://wiki.nginx.org/HttpLuaModule#ngx.now) and [ngx.update_time](http://wiki.nginx.org/HttpLuaModule#ngx.update_time).
|
||||
|
||||
ngx.req.get_method
|
||||
------------------
|
||||
**syntax:** *method_name = ngx.req.get_method()*
|
||||
|
@ -2367,6 +2385,14 @@ is equivalent to
|
|||
ngx.req.clear_header("X-Foo")
|
||||
|
||||
|
||||
ngx.req.clear_header
|
||||
--------------------
|
||||
**syntax:** *ngx.req.clear_header(header_name)*
|
||||
|
||||
**context:** *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua**
|
||||
|
||||
Clear the current request's request header named `header_name`. None of the current request's subrequests will be affected.
|
||||
|
||||
ngx.req.read_body
|
||||
-----------------
|
||||
**syntax:** *ngx.req.read_body()*
|
||||
|
@ -2571,14 +2597,6 @@ If any request body data has been pre-read into the Nginx core request header bu
|
|||
|
||||
This function was first introduced in the `v0.5.0rc1` release.
|
||||
|
||||
ngx.req.clear_header
|
||||
--------------------
|
||||
**syntax:** *ngx.req.clear_header(header_name)*
|
||||
|
||||
**context:** *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua**
|
||||
|
||||
Clear the current request's request header named `header_name`. None of the current request's subrequests will be affected.
|
||||
|
||||
ngx.exec
|
||||
--------
|
||||
**syntax:** *ngx.exec(uri, args?)*
|
||||
|
@ -3121,7 +3139,7 @@ ngx.now
|
|||
|
||||
Returns a floating-point number for the elapsed time in seconds (including milliseconds as the decimal part) from the epoch for the current time stamp from the nginx cached time (no syscall involved unlike Lua's date library).
|
||||
|
||||
Use the Nginx core [timer_resolution](http://wiki.nginx.org/CoreModule#timer_resolution) directive to adjust the accuracy or forcibly update the Nginx time cache by calling [ngx.update_time](http://wiki.nginx.org/HttpLuaModule#ngx.update_time) first.
|
||||
You can forcibly update the Nginx time cache by calling [ngx.update_time](http://wiki.nginx.org/HttpLuaModule#ngx.update_time) first.
|
||||
|
||||
This API was first introduced in `v0.3.1rc32`.
|
||||
|
||||
|
@ -3196,19 +3214,6 @@ Parse the http time string (as returned by [ngx.http_time](http://wiki.nginx.org
|
|||
end
|
||||
|
||||
|
||||
ngx.req.start_time
|
||||
------------------
|
||||
**syntax:** *secs = ngx.req.start_time()*
|
||||
|
||||
**context:** *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua**
|
||||
|
||||
Returns a floating-point number representing the timestamp (including milliseconds as the decimal part) when the current request was created.
|
||||
|
||||
The following example is similar to $request_time in Nginx log module :
|
||||
|
||||
local request_time = ngx.now() - ngx.req.start_time()
|
||||
|
||||
|
||||
ngx.is_subrequest
|
||||
-----------------
|
||||
**syntax:** *value = ngx.is_subrequest*
|
||||
|
|
|
@ -1880,6 +1880,23 @@ Note that <code>ngx.header</code> is not a normal Lua table and as such, it is n
|
|||
|
||||
For reading ''request'' headers, use the [[#ngx.req.get_headers|ngx.req.get_headers]] function instead.
|
||||
|
||||
== ngx.req.start_time ==
|
||||
'''syntax:''' ''secs = ngx.req.start_time()''
|
||||
|
||||
'''context:''' ''set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua*''
|
||||
|
||||
Returns a floating-point number representing the timestamp (including milliseconds as the decimal part) when the current request was created.
|
||||
|
||||
The following example emulates the <code>$request_time</code> variable value (provided by [[HttpLogModule]]) in pure Lua:
|
||||
|
||||
<geshi lang="lua">
|
||||
local request_time = ngx.now() - ngx.req.start_time()
|
||||
</geshi>
|
||||
|
||||
This function was first introduced in the <code>v0.7.7</code> release.
|
||||
|
||||
See also [[#ngx.now|ngx.now]] and [[#ngx.update_time|ngx.update_time]].
|
||||
|
||||
== ngx.req.get_method ==
|
||||
'''syntax:''' ''method_name = ngx.req.get_method()''
|
||||
|
||||
|
@ -2300,6 +2317,13 @@ is equivalent to
|
|||
ngx.req.clear_header("X-Foo")
|
||||
</geshi>
|
||||
|
||||
== ngx.req.clear_header ==
|
||||
'''syntax:''' ''ngx.req.clear_header(header_name)''
|
||||
|
||||
'''context:''' ''set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*''
|
||||
|
||||
Clear the current request's request header named <code>header_name</code>. None of the current request's subrequests will be affected.
|
||||
|
||||
== ngx.req.read_body ==
|
||||
'''syntax:''' ''ngx.req.read_body()''
|
||||
|
||||
|
@ -2494,13 +2518,6 @@ If any request body data has been pre-read into the Nginx core request header bu
|
|||
|
||||
This function was first introduced in the <code>v0.5.0rc1</code> release.
|
||||
|
||||
== ngx.req.clear_header ==
|
||||
'''syntax:''' ''ngx.req.clear_header(header_name)''
|
||||
|
||||
'''context:''' ''set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*''
|
||||
|
||||
Clear the current request's request header named <code>header_name</code>. None of the current request's subrequests will be affected.
|
||||
|
||||
== ngx.exec ==
|
||||
'''syntax:''' ''ngx.exec(uri, args?)''
|
||||
|
||||
|
@ -3017,7 +3034,7 @@ Updates of the Nginx time cache an be forced by calling [[#ngx.update_time|ngx.u
|
|||
|
||||
Returns a floating-point number for the elapsed time in seconds (including milliseconds as the decimal part) from the epoch for the current time stamp from the nginx cached time (no syscall involved unlike Lua's date library).
|
||||
|
||||
Use the Nginx core [[CoreModule#timer_resolution|timer_resolution]] directive to adjust the accuracy or forcibly update the Nginx time cache by calling [[#ngx.update_time|ngx.update_time]] first.
|
||||
You can forcibly update the Nginx time cache by calling [[#ngx.update_time|ngx.update_time]] first.
|
||||
|
||||
This API was first introduced in <code>v0.3.1rc32</code>.
|
||||
|
||||
|
@ -3086,18 +3103,6 @@ Parse the http time string (as returned by [[#ngx.http_time|ngx.http_time]]) int
|
|||
end
|
||||
</geshi>
|
||||
|
||||
== ngx.req.start_time ==
|
||||
'''syntax:''' ''secs = ngx.req.start_time()''
|
||||
|
||||
'''context:''' ''set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua*''
|
||||
|
||||
Returns a floating-point number representing the timestamp (including milliseconds as the decimal part) when the current request was created.
|
||||
|
||||
The following example is similar to $request_time in Nginx log module :
|
||||
<geshi lang="nginx">
|
||||
local request_time = ngx.now() - ngx.req.start_time()
|
||||
</geshi>
|
||||
|
||||
== ngx.is_subrequest ==
|
||||
'''syntax:''' ''value = ngx.is_subrequest''
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче