Skip to content

BUG: The expiration time may not take effect  #48

Description

@Mhaoyuan

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()?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions