2024-03-04 11:24:25 +07:00
|
|
|
import 'package:appflowy/shared/appflowy_cache_manager.dart';
|
2024-01-20 23:16:18 +08:00
|
|
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
|
|
|
|
2024-03-04 11:24:25 +07:00
|
|
|
class CustomImageCacheManager extends CacheManager
|
|
|
|
with ImageCacheManager
|
|
|
|
implements ICache {
|
2024-01-25 16:37:36 +01:00
|
|
|
CustomImageCacheManager._() : super(Config(key));
|
2024-01-20 23:16:18 +08:00
|
|
|
|
2024-01-25 16:37:36 +01:00
|
|
|
factory CustomImageCacheManager() => _instance;
|
2024-01-20 23:16:18 +08:00
|
|
|
|
2024-01-25 16:37:36 +01:00
|
|
|
static final CustomImageCacheManager _instance = CustomImageCacheManager._();
|
2024-01-20 23:16:18 +08:00
|
|
|
|
2024-01-25 16:37:36 +01:00
|
|
|
static const key = 'appflowy_image_cache';
|
2024-03-04 11:24:25 +07:00
|
|
|
|
|
|
|
@override
|
|
|
|
Future<int> cacheSize() async {
|
|
|
|
// https://github.com/Baseflow/flutter_cache_manager/issues/239#issuecomment-719475429
|
|
|
|
// this package does not provide a way to get the cache size
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> clearAll() async {
|
|
|
|
await emptyCache();
|
|
|
|
}
|
2024-01-20 23:16:18 +08:00
|
|
|
}
|