From 68a493ef22cb0558a05dd3881c7d8cb4999d9679 Mon Sep 17 00:00:00 2001 From: "Begonia, HE" <163421589+BegoniaHe@users.noreply.github.com> Date: Tue, 27 Jan 2026 05:56:59 +0100 Subject: feat(java): implement cache versioning, size limits, and automatic cleanup - Add CACHE_VERSION constant for cache format compatibility tracking - Add MAX_CACHE_SIZE_BYTES limit (10 MB) to prevent unbounded cache growth - Add cache_version field to JavaCatalog struct with default value - Implement cache version validation in load_cached_catalog() - Implement cache size enforcement in save_catalog_cache() - Add cleanup_expired_caches() for background cache cleanup - Add enforce_cache_size_limit() to validate cache file sizes - Add is_cache_version_compatible() helper function - Automatically clean up expired caches on load and clear operations - Validate cache version before using cached data Fixes: - Cache expiration without automatic cleanup (now cleaned on load) - Missing cache version control (now validates format compatibility) - Unbounded cache size growth (now limited to 10 MB) Reviewed-by: Claude 3.5 Sonnet --- src-tauri/src/core/java/providers/adoptium.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src-tauri/src/core/java/providers/adoptium.rs b/src-tauri/src/core/java/providers/adoptium.rs index 13ef2a5..4b06721 100644 --- a/src-tauri/src/core/java/providers/adoptium.rs +++ b/src-tauri/src/core/java/providers/adoptium.rs @@ -198,6 +198,7 @@ impl JavaProvider for AdoptiumProvider { available_major_versions: available.available_releases, lts_versions: available.available_lts_releases, cached_at: now, + cache_version: 1, }; let _ = super::super::save_catalog_cache(app_handle, &catalog); -- cgit v1.2.3-70-g09d2