Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

补充日期函数的基础使用方法 #315

Merged
merged 2 commits into from
Jan 5, 2021

Conversation

Miss-you
Copy link
Contributor

介绍 ngx.today, ngx.time, ngx.utctime, ngx.localtime, ngx.now, ngx.http_time,以及 ngx.cookie_time 基本使用办法以及其原理

关键点:
事实上,在 Nginx/Openresty 中,会经常使用到获取时间操作,通常一次请求最少有几十次获取时间操作,当单核心 RPS/QPS 达到 10K 以上时,获取时间操作往往会达到 200K+量级的调用,是一个非常高频的调用。所以 Nginx 会将时间和日期进行缓存,并非每次调用或每次请求获取时间和日期。

推荐 使用 ngx_lua 模块提供的带缓存的时间接口,如 ngx.today, ngx.time, ngx.utctime,
ngx.localtime, ngx.now, ngx.http_time,以及 ngx.cookie_time 等。

ref:
#312

…, `ngx.http_time`,以及 `ngx.cookie_time` 等时间与日期接口使用文档
@membphis membphis merged commit 207e6a8 into moonbingbing:master Jan 5, 2021
@Miss-you Miss-you deleted the docc-20201231 branch March 9, 2021 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants