Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
218 views
in Technique[技术] by (71.8m points)

android - Limit size of cache directory

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...