Repository: epwalsh/rust-cached-path (language: rust)

Issue:
Cleanup implemented?
Hi,
I tried looking at a few places, but looks like cleanup isn't implemented, but it's mentioned here:

https://github.com/epwalsh/rust-cached-path/blob/main/src/cache.rs#L387-L388

Is there anything I might be missing?


Discussion / hints:
Oh, that comment is misleading and should be changed. I decided against automatic cache eviction for safety reasons.

Fix patch:
diff --git a/src/cache.rs b/src/cache.rs
index 2041adf..f389725 100644
--- a/src/cache.rs
+++ b/src/cache.rs
@@ -384,8 +384,7 @@ impl Cache {
                 return Err(Error::NoCachedVersions(String::from(resource)));
             }
         } else if !versions.is_empty() && versions[0].is_fresh(self.freshness_lifetime) {
-            // Oh hey, the latest version is still fresh! We can clean up any
-            // older versions and return the latest.
+            // Oh hey, the latest version is still fresh!
             info!("Latest cached version of {} is still fresh", resource);
             return Ok(versions[0].clone());
         }


Test patch: