pub fn check_cache(cache_dir: &Utf8Path, version: &str) -> CacheLookupResultExpand description
Checks if the cache contains valid binaries for the given version.
A cache entry is considered valid if:
- The version directory exists
- The
.completemarker file is present - The
binsubdirectory exists (indicating extracted binaries)
§Arguments
cache_dir- Root directory of the binary cacheversion- Exact version string to look up (e.g., “17.4.0”)
§Examples
use camino::Utf8Path;
use pg_embedded_setup_unpriv::cache::{check_cache, CacheLookupResult};
let cache_dir = Utf8Path::new("/home/user/.cache/pg-embedded/binaries");
match check_cache(cache_dir, "17.4.0") {
CacheLookupResult::Hit { source_dir } => {
println!("Found cached binaries at {source_dir}");
}
CacheLookupResult::Miss => {
println!("Cache miss, need to download");
}
}