pub fn insert_or_update(
from: impl AsRef<Path>,
to: impl AsRef<Path>,
) -> Result<()>Expand description
Consumes the file from and publishes it to the raw cache file
to, a file directly under the raw cache directory.
On success, from is deleted. On failure, the cache directory is
always in a valid state.
The rename will be atomic, but the source file must be private to the caller: this function accesses the source file multiple time.
If durability is necessary, the caller is responsible for
sync_dataing the contents of from. This function does not
fsync the cache directory itself: it’s a cache, so stale contents
are assumed safe.