Skip to content

Commit b79cbe7

Browse files
authored
optimize: load 'resty.core.misc' last to avoid metatable lookups on 'ngx'.
This ensures that all `resty.core` modules setting values under the `ngx` table can do so without having to enter the `__newindex` metamethod set by `resty.core.misc`. This commit also includes a style fix.
1 parent 6805515 commit b79cbe7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/resty/core.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
local subsystem = ngx.config.subsystem
44

55

6-
require "resty.core.ctx"
76
require "resty.core.var"
87
require "resty.core.worker"
98
require "resty.core.regex"
109
require "resty.core.shdict"
1110
require "resty.core.time"
12-
require "resty.core.misc"
1311
require "resty.core.hash"
1412
require "resty.core.uri"
1513
require "resty.core.exit"
@@ -24,6 +22,10 @@ if subsystem == 'http' then
2422
end
2523

2624

25+
require "resty.core.misc"
26+
require "resty.core.ctx"
27+
28+
2729
local base = require "resty.core.base"
2830

2931

lib/resty/core/shdict.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int ngx_http_lua_ffi_shdict_store(void *zone, int op,
6262
int ngx_http_lua_ffi_shdict_flush_all(void *zone);
6363

6464
long ngx_http_lua_ffi_shdict_get_ttl(void *zone,
65-
const unsigned char *key, size_t key_len);
65+
const unsigned char *key, size_t key_len);
6666

6767
int ngx_http_lua_ffi_shdict_set_expire(void *zone,
6868
const unsigned char *key, size_t key_len, long exptime);

0 commit comments

Comments
 (0)