pub fn new(
name: &str,
max_age: Duration,
) -> Result<Box<dyn Cache>, FileCacheError>Expand description
Ported from New. Derives the cache path from name and the OS user
cache directory (dirs::cache_dir(), the Rust-idiomatic equivalent of
Go’s os.UserCacheDir(): $XDG_CACHE_HOME/~/.cache on Linux,
~/Library/Caches on macOS), then delegates to new_at. There is
no Go test for this path directly (filecache_test.go only tests the
zero-maxAge rejection here; everything else goes through
new_at), matching the same “ambient OS state has no test to port
against” situation as datadir::dir_in’s caller-resolves-$HOME
design – this is simple enough, and specified precisely enough by the
Go source, not to need one invented.