tokio-dns
tokio-dns copied to clipboard
Add LRU cache support
Does this crate have the cache support? I am not carefully review the source code, but seems there have no cache support.
There's no caching inside this crate, but since it uses getaddrinfo
, there might be caching involved behind the scenes, depending on the operating system.
So, any plan to support caching? I think provide a clear, controllable caching to user is better than the potential system caching. Maybe you can consider to use lru_time_cache to provide a optional caching.
- How do you want to pick the time the info should stay in the cache? We don't have access to TTL information. Let the user configure it?
- The
lru_time_cache
crate is licensed under the GPL-3.0, so we can't use their library in this crate without changing the license.
- Yes, give user the option to configure it depend on their use case.
- How about lru-cache? It support cache with capacity limit.
I think that a cache option could be added to the CpuPoolResolver, but I wouldn't give the default resolver a cache (the lazy static one). So you could only get cache benefits by using a custom resolver, and the *_with
methods. Does that sound fair to you? Also do you want to implement it or should I?
It's ok. I just want use your lib in my next project, and I am a little busy currently. So, it's not hurry. But it would be helpful if you can give more examples about how to use your lib, like: how to implement a simple custom resolver : )