-
Notifications
You must be signed in to change notification settings - Fork 105
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
Implement Clone on LruCache #190
Comments
I can't think of any explicit reason why |
Ok sure. I've look at the code a little bit and did not realized it's complexity (I've never used My first though was to either derive Do you think that the function above is correctly "cloning" the |
My initial thought was that it might be simplest to implement it manually by cloning all the items in the cache. Would it be possible to create a new empty cache and then iterate over all the elements in the old cache and insert them into the new one? If we iterate over the items in reverse order then they will be inserted into the new cache in the correct order. |
@jeromefroe Yes exactly. This is what the If you are ok with this implementation, I'll make a PR with it. |
Oh yep, that implementation looks good to me, would be happy to review your PR :) |
We'd need to
clone
ourLruCache
but it does not seems possible. Is there a technical reason whyClone
is not implemented ?For the time being, I'm using the following code:
I would be open to work on this issue if there is no particular reason why
Clone
should not be implemented ontoLruCache
.The text was updated successfully, but these errors were encountered: