refactor(storage): unified storage cache layer and preasign interface

- Updated storage wrappers to utilize a new base class, StorageWrapper, for better delegation of methods.
- Introduced SilentStorage to handle read operations gracefully by returning empty values instead of raising exceptions.
- Enhanced CachedPresignStorage to support batch caching of download URLs, improving performance.
- Refactored FilePresignStorage to support both presigned URLs and signed proxy URLs for downloads.
- Updated AppAssetService to utilize the new storage structure, ensuring consistent asset management.
This commit is contained in:
Harry
2026-01-23 17:01:10 +08:00
parent 3165f3adbe
commit 248fa38c34
12 changed files with 209 additions and 88 deletions

View File

@ -63,7 +63,9 @@ class TestCachedPresignStorage:
assert result == ["https://cached1.com", "https://new.com", "https://cached2.com"]
mock_storage.get_download_url.assert_called_once_with("file2.txt", 3600)
mock_redis.setex.assert_called_once()
# Verify pipeline was used for batch cache write
mock_redis.pipeline.assert_called_once()
mock_redis.pipeline().execute.assert_called_once()
def test_get_download_urls_empty_list(self, cached_storage, mock_storage, mock_redis):
"""Test batch URL retrieval with empty list."""