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

bugfix: fix edge cases related to time atomicity #123

Closed posborne closed 4 years ago

posborne commented 5 years ago

These changes aim to make it so that calls to the public API operate over the cache using a single Instant of time rather than calling Instant::now() at several unique points in time during the synchronous execution of the function.

The former execution model lead to potential bugs, notably in functions like entry() as brought up in #122, especially on targets with less processing power or under heavy load.

This also reduces the number of system calls that need to be made which may improve performance for some use cases.

posborne commented 4 years ago

@ustulation Can I get a review on this; it should be noted that the cache implementation is fundamentally broken without some change.

kosta commented 4 years ago

I'm a user of the lru_time_cache library and I would like to see this bug fixed.

I chose the lru_time_cache library due to its lack of unsound unsafe code. There's not that many lru caches in rust. Thank you for providing and maintaining it! I hope it's not rude to ping this issue after 3 months :)

S-Coyle commented 4 years ago

Resolved by #126 , thanks to @calavera New release to follow