flutter_cache_manager icon indicating copy to clipboard operation
flutter_cache_manager copied to clipboard

Get cache size

Open alr2413 opened this issue 3 years ago • 9 comments

Hi, in the previous version 1.x.x, we can use the await DefaultCacheManager().getFilePath() syntax to get the default cache directory path. how should we get that path in the new version 2 since there is no "getFilePath()" method anymore? Thanks in advance

alr2413 avatar Oct 20 '20 11:10 alr2413

What's the usecase that you need to know the directory path?

renefloor avatar Oct 20 '20 15:10 renefloor

To calculate the cache size as mentioned in #83

alr2413 avatar Oct 20 '20 19:10 alr2413

I've been thinking about adding the getFilePath again, but that is not really a great solution. For example for web there is not really a path, so it wouldn't be consistent over platforms. I think it is better to implement a method to get the cache size. Would that be a good alternative for you?

renefloor avatar Oct 30 '20 10:10 renefloor

Yea, i've checked the previous version of the package and figured out how to add the "getFilePath" method to my custom implementation. Thanks.

alr2413 avatar Oct 31 '20 07:10 alr2413

same question

kamike avatar Dec 30 '20 09:12 kamike

Is there currently a way to get the total size of cache and the number of objects cached?

esiqveland avatar Apr 09 '21 15:04 esiqveland

Is this implemented?

aintend-com avatar Nov 07 '22 21:11 aintend-com

@renefloor how about something like:

https://github.com/jithware/flutter_cache_manager/blob/develop/flutter_cache_manager/lib/src/cache_store.dart#L194-L198

jithware avatar Nov 14 '22 14:11 jithware

Related to https://github.com/Baseflow/flutter_cache_manager/issues/398

Nico04 avatar Nov 03 '23 10:11 Nico04