updated localstore collection to global constant
This commit is contained in:
1 parent
19aca8f97f
commit
f5407d2477
16 files changed
+24
-23
No files matched your search
@@ -1,14 +1,14 @@
|
||||
import 'package:localstore/localstore.dart';
|
||||
|
||||
import '../widget/debug/cacheView.dart';
|
||||
import '../api/requestCache.dart';
|
||||
|
||||
class DataCleaner {
|
||||
static Future<void> cleanOldCache() async {
|
||||
var cacheData = await Localstore.instance.collection(CacheView.collection).get();
|
||||
var cacheData = await Localstore.instance.collection(RequestCache.collection).get();
|
||||
cacheData?.forEach((key, value) async {
|
||||
var lastUpdate = DateTime.fromMillisecondsSinceEpoch(value['lastupdate']);
|
||||
if(DateTime.now().subtract(const Duration(days: 200)).isAfter(lastUpdate)) {
|
||||
await Localstore.instance.collection(CacheView.collection).doc(key.split('/').last).delete();
|
||||
await Localstore.instance.collection(RequestCache.collection).doc(key.split('/').last).delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user