Skip to content

Commit

Permalink
Merge pull request #449 from liasica/develop
Browse files Browse the repository at this point in the history
Get cache total size
  • Loading branch information
martijn00 authored Jul 31, 2024
2 parents a1b4955 + ba41d3c commit d6ddc33
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions flutter_cache_manager/lib/src/cache_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,14 @@ class CacheStore {
final provider = await _cacheInfoRepository;
await provider.close();
}

Future<int> getCacheSize() async {
final provider = await _cacheInfoRepository;
final allObjects = await provider.getAllObjects();
int total = 0;
for (var cacheObject in allObjects) {
total += cacheObject.length ?? 0;
}
return total;
}
}

0 comments on commit d6ddc33

Please sign in to comment.