MCPcopy Create free account
hub / github.com/KingOfBugbounty/enumrust / read_cache

Function read_cache

src/update_checker.rs:45–53  ·  view source on GitHub ↗

Read cached version if still valid (< 24h old)

()

Source from the content-addressed store, hash-verified

43
44/// Read cached version if still valid (< 24h old)
45fn read_cache() -> Option<String> {
46 let data = std::fs::read_to_string(cache_path()).ok()?;
47 let cache: UpdateCache = serde_json::from_str(&data).ok()?;
48 if now_secs().saturating_sub(cache.last_check) < CACHE_DURATION_SECS {
49 Some(cache.latest_version)
50 } else {
51 None
52 }
53}
54
55/// Write version to cache
56fn write_cache(version: &str) {

Callers 1

check_and_updateFunction · 0.85

Calls 2

cache_pathFunction · 0.85
now_secsFunction · 0.85

Tested by

no test coverage detected