mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
Merge pull request #3 from Pacalini/cache
cache manager: fix setLimitSize & checkCache
This commit is contained in:
@@ -135,7 +135,7 @@ class CacheManager {
|
||||
WHERE expires < ?
|
||||
''', [DateTime.now().millisecondsSinceEpoch]);
|
||||
for(var row in res){
|
||||
var dir = row[1] as int;
|
||||
var dir = row[1] as String;
|
||||
var name = row[2] as String;
|
||||
var file = File('$cachePath/$dir/$name');
|
||||
if(await file.exists()){
|
||||
@@ -158,12 +158,12 @@ class CacheManager {
|
||||
while((_currentSize != null && _currentSize! > _limitSize) || count > 2000){
|
||||
var res = _db.select('''
|
||||
SELECT * FROM cache
|
||||
ORDER BY time ASC
|
||||
ORDER BY expires ASC
|
||||
limit 10
|
||||
''');
|
||||
for(var row in res){
|
||||
var key = row[0] as String;
|
||||
var dir = row[1] as int;
|
||||
var dir = row[1] as String;
|
||||
var name = row[2] as String;
|
||||
var file = File('$cachePath/$dir/$name');
|
||||
if(await file.exists()){
|
||||
|
@@ -79,7 +79,7 @@ class _AppSettingsState extends State<AppSettings> {
|
||||
appdata.saveData();
|
||||
setState(() {});
|
||||
CacheManager()
|
||||
.setLimitSize(appdata.settings['cacheSize'] * 1024 * 1024);
|
||||
.setLimitSize(appdata.settings['cacheSize']);
|
||||
return null;
|
||||
},
|
||||
);
|
||||
|
Reference in New Issue
Block a user