-
Notifications
You must be signed in to change notification settings - Fork 107
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
Cache MX and A server lookups #256
Conversation
a12df3a
to
ec38120
Compare
Hi @micke, please let me know if this isn't what you had in mind. Happy to follow a different path 👍 |
This is a good start, i'm however thinking that we might need to consider two factors still:
|
Thanks for the feedback, @micke. Any thoughts on a maximum size for the cache? |
7e2944a
to
4bf848d
Compare
@micke, I've gone ahead and pushed up some additional commits that should meet these requirements. I've arbitrarily selected 1,000 as the max cache size. Please feel free to suggest a different value! Also, a lot of this code could be DRY-ed up; if you like the implementation I’ll do so. |
@ianbayne Great work! What do you think about maybe moving the caching logic to it's own class? |
Thanks! Sure, works for me. I’ll get on it when I’ve next got some spare time 👍 |
e5e986c
to
519ee1c
Compare
519ee1c
to
a3575b9
Compare
@@ -5,6 +5,7 @@ | |||
require 'rspec-benchmark' | |||
RSpec.configure do |config| | |||
config.include RSpec::Benchmark::Matchers | |||
config.default_formatter = 'doc' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer this personally, but feel free to delete if you'd rather not have it.
@@ -0,0 +1,37 @@ | |||
module ValidEmail2 | |||
class DnsRecordsCache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DnsRecordsCache
Definitely open to different/better naming for this!
This is great stuff @ianbayne! One other optimization I can see being useful here is to move the setup of Resolv::DNS::Config into these functions where it's actually used. We're seeing a perf problem with heavy use of this gem where it's spending a lot of time setting up this config even though we're only calling |
@ianbayne huge thank you for this! Great work! |
Closes #179.