Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Add LRU cache support #2

Open
loggerhead opened this issue Sep 10, 2016 · 6 comments
Open

Add LRU cache support #2

loggerhead opened this issue Sep 10, 2016 · 6 comments

Comments

@loggerhead
Copy link

Does this crate have the cache support? I am not carefully review the source code, but seems there have no cache support.

@sbstp
Copy link
Owner

sbstp commented Sep 10, 2016

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.

@loggerhead
Copy link
Author

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.

@sbstp
Copy link
Owner

sbstp commented Sep 13, 2016

  1. 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?
  2. 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.

@loggerhead
Copy link
Author

  1. Yes, give user the option to configure it depend on their use case.
  2. How about lru-cache? It support cache with capacity limit.

@sbstp
Copy link
Owner

sbstp commented Sep 16, 2016

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?

@loggerhead
Copy link
Author

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 : )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants