tags:

views:

292

answers:

2

I have some questions about the cache directory in android.

  1. Does anyone knows the limit for each app's cache directory?

  2. Also what will happen if there is not enough disk space to cache data? All I know is when the device runs low on storage, the files here (cache directory)will be the ones that get deleted first and each app has its own cache directory. Now, are the files of other app's cache directory will be cleared to accommodate my app's request to add files in the cache dir when there is not enough storage?

A: 

On PC I wrote a little script for cleaning up Opera browser cache directory for limiting it to reasonable size (or file count). May be there are some such program available?

Google: http://www.google.ru/search?q=android+cache+cleaner

brings a lot of links:

  1. http://www.cyrket.com/p/android/Help_To.ClearMe/
  2. http://android-games.info/apps/cache-cleaner/
Denis Barmenkov
+5  A: 

There is no per-application limit for the cache directory. While Linux has a quota subsystem built-in, it is not used by Android. Applications share the cache filesystem without any real constraints. As it fills up, the Device Storage Monitor sends out an ACTION_DEVICE_STORAGE_LOW broadcast and calls a method of the Package Manager Service that sends a "freecache" command to the Install Daemon. The installd process then walks through the cache directory deleting files without regard to the owning application or modification date until the amount of free space available is above some threshold.

Tim Kryger