feat: max cache size

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-20 20:39:17 +08:00
parent a2af297a84
commit ae901c709d
7 changed files with 78 additions and 10 deletions

View File

@@ -31,8 +31,16 @@ void main() async {
WidgetsFlutterBinding.ensureInitialized();
MediaKit.ensureInitialized();
await GStorage.init();
if (GStorage.setting.get(SettingBoxKey.autoClearCache, defaultValue: true)) {
if (GStorage.setting.get(SettingBoxKey.autoClearCache, defaultValue: false)) {
await CacheManage.clearLibraryCache();
} else {
final num maxCacheSize = GStorage.maxCacheSize;
if (maxCacheSize != 0) {
final double currCache = await CacheManage().loadApplicationCache();
if (currCache >= maxCacheSize) {
await CacheManage.clearLibraryCache();
}
}
}
if (GStorage.setting
.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {