Last active
August 29, 2015 13:56
-
-
Save s-tajima/9088511 to your computer and use it in GitHub Desktop.
fluentd source code for explain dns cache behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def resolved_host | |
case @expire_dns_cache | |
when 0 | |
# cache is disabled | |
return resolve_dns! | |
when nil | |
# persistent cache | |
return @resolved_host ||= resolve_dns! | |
else | |
now = Engine.now | |
rh = @resolved_host | |
if !rh || now - @resolved_time >= @expire_dns_cache | |
rh = @resolved_host = resolve_dns! | |
@resolved_time = now | |
end | |
return rh | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment