mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 17:08:03 +08:00
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:
@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user