comparison mod_s2s_auth_posh/mod_s2s_auth_posh.lua @ 3200:d070a751b6ed

mod_s2s_auth_posh: Cache tweak
author Kim Alvefur <zash@zash.se>
date Thu, 21 Dec 2017 03:04:51 +0100
parents cb7c24305ed2
children 73be17be7d84
comparison
equal deleted inserted replaced
3199:cb7c24305ed2 3200:d070a751b6ed
31 elseif host_session.direction == "outgoing" then 31 elseif host_session.direction == "outgoing" then
32 target_host = host_session.to_host; 32 target_host = host_session.to_host;
33 end 33 end
34 34
35 local cached = cache:get(target_host); 35 local cached = cache:get(target_host);
36 if cached and os.time() < cached.expires then 36 if cached then
37 host_session.posh = { jwk = cached }; 37 if os.time() > cached.expires then
38 return false; 38 cache:set(target_host, nil);
39 else
40 host_session.posh = { jwk = cached };
41 return false;
42 end
39 end 43 end
40 local log = host_session.log or module._log; 44 local log = host_session.log or module._log;
41 45
42 log("debug", "Session direction: %s", tostring(host_session.direction)); 46 log("debug", "Session direction: %s", tostring(host_session.direction));
43 47