bugfix: the exptime argument to shdict:set/add/etc methods was incorrectly ignored when the flags argument is also specified. thanks the patch from Brian Akins.
This commit is contained in:
Родитель
81f1d7ca4a
Коммит
ec4becfead
|
@ -591,7 +591,7 @@ ngx_http_lua_shdict_set_helper(lua_State *L, int flags)
|
|||
lua_typename(L, value_type));
|
||||
}
|
||||
|
||||
if (n == 4) {
|
||||
if (n >= 4) {
|
||||
exptime = luaL_checknumber(L, 4);
|
||||
if (exptime < 0) {
|
||||
exptime = 0;
|
||||
|
|
|
@ -1019,3 +1019,27 @@ GET /test
|
|||
199 number
|
||||
10502 number
|
||||
nil nil
|
||||
|
||||
|
||||
|
||||
=== TEST 43: expired entries (can be auto-removed by get), with flags set
|
||||
--- http_config
|
||||
lua_shared_dict dogs 1m;
|
||||
--- config
|
||||
location = /test {
|
||||
content_by_lua '
|
||||
local dogs = ngx.shared.dogs
|
||||
dogs:set("foo", 32, 0.01, 255)
|
||||
ngx.location.capture("/sleep/0.01")
|
||||
local res, flags = dogs:get("foo")
|
||||
ngx.say("res = ", res, ", flags = ", flags)
|
||||
';
|
||||
}
|
||||
location ~ '^/sleep/(.+)' {
|
||||
echo_sleep $1;
|
||||
}
|
||||
--- request
|
||||
GET /test
|
||||
--- response_body
|
||||
res = nil, flags = nil
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче