Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does getExternalCacheDir() work on 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(), as opposed to getCacheDir() points to the external filesystem - which seems to me as a normal getExternalFilesDir().

How does Android optimize access to ExternalCacheDir? Is it something like the "swap" space on Linux?

like image 959
dev Avatar asked Dec 05 '12 19:12

dev


1 Answers

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().

like image 60
Jorge Avatar answered Oct 07 '22 05:10

Jorge