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

BUG: The expiration time may not take effect #48

Open
Mhaoyuan opened this issue Dec 25, 2020 · 0 comments
Open

BUG: The expiration time may not take effect #48

Mhaoyuan opened this issue Dec 25, 2020 · 0 comments

Comments

@Mhaoyuan
Copy link

Mhaoyuan commented Dec 25, 2020

lrucache:set(key, value, ttl, flags)
os.execute("sleep " .. tonumber(ttl+2))
local data, stale_data, flags = lrucache:get(key)
data is not nil

lruchache' get method
if node.expire >= 0 and node.expire < ngx_now() then
return nil, val, node.user_flags
end

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). https://github.com/openresty/lua-nginx-module#ngxnow

Is it better to add an ngx.update_time()?

@Mhaoyuan Mhaoyuan changed the title BUF BUG: The expiration time may not take effect Dec 25, 2020
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

No branches or pull requests

1 participant