From 261c3996805bcdfb7ff271290f3e3557dd15cea7 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 21 Feb 2026 16:59:31 +0900 Subject: feat(cache): add filesystem-backed cache with TTL expiration and size-limited GC Implement a cache module with CacheConfig and Cache structs supporting read/write (string and binary), atomic writes via temp+rename, TTL-based expiration, and size-limited garbage collection. Wire the repo cache into packagist.rs and resolver.rs for API response caching, and the files cache into downloader.rs for dist archive caching. Implement the clear-cache command with full clear and --gc modes. All existing call sites pass None for backward compatibility. Co-Authored-By: Claude Opus 4.6 --- crates/mozart/src/commands/remove.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/mozart/src/commands/remove.rs') diff --git a/crates/mozart/src/commands/remove.rs b/crates/mozart/src/commands/remove.rs index 3010547..ecfbba8 100644 --- a/crates/mozart/src/commands/remove.rs +++ b/crates/mozart/src/commands/remove.rs @@ -268,6 +268,7 @@ pub fn execute(args: &RemoveArgs, cli: &super::Cli) -> anyhow::Result<()> { platform: PlatformConfig::new(), ignore_platform_reqs: args.ignore_platform_reqs, ignore_platform_req_list: args.ignore_platform_req.clone(), + repo_cache: None, }; // Print header messages @@ -365,6 +366,7 @@ pub fn execute(args: &RemoveArgs, cli: &super::Cli) -> anyhow::Result<()> { composer_json_content: composer_json_content.clone(), composer_json: raw.clone(), include_dev: dev_mode, + repo_cache: None, })?; // Compute and print change report @@ -701,6 +703,7 @@ mod tests { platform: crate::resolver::PlatformConfig::new(), ignore_platform_reqs: false, ignore_platform_req_list: vec![], + repo_cache: None, }; let resolved = resolve(&request).expect("initial resolution should succeed"); let initial_lock = generate_lock_file(&LockFileGenerationRequest { @@ -708,6 +711,7 @@ mod tests { composer_json_content: content.to_string(), composer_json: raw.clone(), include_dev: false, + repo_cache: None, }) .expect("initial lock file generation should succeed"); initial_lock @@ -730,6 +734,7 @@ mod tests { platform: crate::resolver::PlatformConfig::new(), ignore_platform_reqs: false, ignore_platform_req_list: vec![], + repo_cache: None, }; let resolved2 = resolve(&request2).expect("post-remove resolution should succeed"); @@ -739,6 +744,7 @@ mod tests { composer_json_content: composer_json_content2, composer_json: raw, include_dev: false, + repo_cache: None, }) .expect("post-remove lock file generation should succeed"); -- cgit v1.3.1