缓存目录的限制大小 [英] Limit size of cache directory

查看:183
本文介绍了缓存目录的限制大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有关于Android的高速缓存目录中的一些问题。

  1. 有谁知道限额为每个应用程序的缓存目录?

  2. 此外,如果没有足够的磁盘空间来缓存数据会怎样呢?我所知道的是,当设备在运行时存储,这里的文件(缓存目录)将是被删除的第1和每个应用程序都有自己的缓存目录。现在,在其他应用程序的缓存目录中的文件将被清除,以适应我的应用程序的要求,在缓存目录添加文件时没有足够的存储空间?

解决方案

有没有每个应用程序的限制缓存目录。虽然 Linux有一个配额子系统内置,它不使用Android系统。应用程序共享缓存文件系统没有任何真正的约束。因为它填满时,<一个href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=services/java/com/android/server/DeviceStorageMonitorService.java;h=57af02953415d74d98912f0527cba5fa463abc5b;hb=HEAD#l194">Device存储监控发出的<一个href="http://developer.android.com/reference/android/content/Intent.html#ACTION_DEVICE_STORAGE_LOW">ACTION_DEVICE_STORAGE_LOW广播和调用的方法<一href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=services/java/com/android/server/PackageManagerService.java;h=cc78300467d2ec5af0f6f29b8b240304fc3a275e;hb=HEAD#l1056">Package管理服务发送一个freecache命令来安装守护程序。该INSTALLD过程然后通过缓存目录<一走href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=cmds/installd/commands.c;h=70a1206b11ecbad1cafaa8da22aa45d79101e5e1;hb=HEAD#l102">deleting不考虑拥有的应用或修改日期到的可用空间量的文件超过某个阈值。

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?

解决方案

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.

这篇关于缓存目录的限制大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆