Skip to content

Instantly share code, notes, and snippets.

@s-tajima
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s-tajima/9088511 to your computer and use it in GitHub Desktop.
Save s-tajima/9088511 to your computer and use it in GitHub Desktop.
fluentd source code for explain dns cache behavior.
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