maidsafe / lru_time_cache

LRU cache settable via size or time to live
BSD 3-Clause "New" or "Revised" License
104 stars 46 forks source link

Implement iterator that updates timestamps #77

Closed andresilva closed 8 years ago

andresilva commented 8 years ago

This PR adds an iter method that returns an iterator over all entries, which updates the timestamps as values are traversed, and removes expired elements before creating the iterator.


This change is Reviewable

maidsafe-highfive commented 8 years ago

Thanks for the pull request, and welcome! The MaidSafe team is excited to review your changes, and you should hear from @Fraser999 (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTOR.md for more information.

andresilva commented 8 years ago

I still need to add a test to make sure that timestamps are updated as the iterator is traversed.

Edit: I just noticed that I forgot to update the list that maintains the keys ordered by access time. Please ignore this PR for now. Fixed in bec3717.

andresilva commented 8 years ago

Added a test for iter.

afck commented 8 years ago

Reviewed 1 of 1 files at r2, 1 of 1 files at r3. Review status: all files reviewed at latest revision, all discussions resolved.


_Comments from Reviewable_