SlowAndSteady SlowAndSteady - 6 months ago 33
Android Question

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.

, as opposed to
points to the external filesystem - which seems to me as a normal

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


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