File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 11// lib/data/cache/mxc_cache_manager.dart
2+ import 'dart:async' ;
23import 'dart:typed_data' ;
34import 'package:matrix/matrix.dart' ;
45import 'database/cache_database_interface.dart' ;
@@ -195,7 +196,9 @@ class MxcCacheManager {
195196 memorySizeBytes: memoryStats.sizeBytes,
196197 memoryUtilization: memoryStats.utilizationPercent,
197198 diskSizeBytes: diskSize,
198- diskUtilization: (diskSize / _config.diskMaxBytes) * 100 ,
199+ diskUtilization: _config.diskMaxBytes > 0
200+ ? (diskSize / _config.diskMaxBytes) * 100
201+ : 0 ,
199202 );
200203 }
201204
@@ -222,6 +225,14 @@ class MxcCacheManager {
222225 void _onCacheUpdated (String mxcUrl, Uint8List newBytes) {
223226 // Update memory cache with fresh content
224227 _memoryTier.put (mxcUrl, newBytes);
228+ // Also update disk tier using fire-and-forget
229+ unawaited (
230+ _diskTier.put (
231+ mxcUrl: mxcUrl,
232+ bytes: newBytes,
233+ mediaType: 'application/octet-stream' ,
234+ ),
235+ );
225236 Logs ().d ('MxcCacheManager: updated $mxcUrl from background revalidation' );
226237 }
227238}
You can’t perform that action at this time.
0 commit comments