如何getExternalCacheDir()在Android上工作? [英] How does getExternalCacheDir() work on Android?

查看:153
本文介绍了如何getExternalCacheDir()在Android上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,我们在高速缓存内存段是更容易获得经常访问的对象比正常磁盘读取。

From what I understand, we cache the frequently accessed objects in a memory segment that is more easily accessible than normal disk reads.

getExternalCacheDir(),而不是getCacheDir()指向外部文件系统 - 这似乎我作为一个正常getExternalFilesDir()。如何优化Android的访问ExternalCacheDiir?是不是像Linux上的交换空间?

getExternalCacheDir(), as opposed to getCacheDir() points to the external filesystem - which seems to me as a normal getExternalFilesDir(). How does Android optimize access to ExternalCacheDiir ? Is it something like the "swap" space on Linux ?

谢谢!

推荐答案

getExternalCacheDir()和getExternalFilesDir()是两个不同的目录。不同的是,第一个仅用于可能由系统或用户(通过设置相应的按钮)被删除,以重新获得空间的临时文件或高速缓存文件。第二个是用于永久文件。无论如何,你必须考虑到关于通过的 getExternalCacheDir()

getExternalCacheDir() and getExternalFilesDir() are two different directories. The difference is that the first one is intended only for temporary files or cache files that could be deleted by the system or the user (through the Settings corresponding button) to regain space. The second one is intended for permanent files. Anyway, you have to take into account the considerations of the documentation regarding the directory returned by getExternalCacheDir().

这篇关于如何getExternalCacheDir()在Android上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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