-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add lru_cache to libextra #10211
Add lru_cache to libextra #10211
Conversation
} | ||
|
||
impl<K: Hash + Eq + Clone, V> LruCache<K, V> { | ||
fn new(max_size: uint) -> LruCache<K, V> { |
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.
pub fn new
?
Is everything good or is there still something that needs fixing? |
It needs a rebase. |
What about now? |
This is a pretty awesome data structure to have, and we've recently had some awesome data structures have pull requests opened. In general, we plan on dissolving libextra soon to a conglomerate of packages (exact details yet to be determined), and this probably belongs in there. In the meantime, we've been hesitant to add more data structures to libextra as a consequence because it's just another thing which we'd have to figure out where to go. This is some nice work though! I think we'll want to discuss this a bit. I've added this to the agenda for the meeting tomorrow. |
@alexcrichton Looks like we never got around to talking about this at a meeting? I'm thinking we should go ahead and add it since it looks nice and is self contained, and if it ends up living somewhere else then so be it. @ktt3ja the motivation for having an LRU cache is for use in servo, so you might ask the people in #servo where this can be applied, see if it fits their use case, then use it there. |
+1 for adding this, FWIW - I think it should go in libstd though (Python has |
We could replace our existing Servo LRU cache implementation: http://mxr.mozilla.org/servo/source/src/components/util/cache.rs#114 |
Whatever happened to this LRU cache? Will it ever be resurrected in std::collections? |
There's an open issue (Issue #4988) for adding an LRU Cache to the standard library. I'm new to this so I hope I didn't miss anything I'm supposed to do.