How does getExternalCacheDir () work on Android?

From what I understand, we cache frequently used objects in a memory segment that is more easily accessible than regular reads on disk.

getExternalCacheDir() , unlike getCacheDir() points to an external file system - this seems normal to me getExternalFilesDir() .

How does Android optimize access to ExternalCacheDir? Is this something like swap space on Linux?

+7
source share
1 answer

getExternalCacheDir() and getExternalFilesDir() are two different directories.

The difference is that the first is only for temporary files or cache files that can be deleted by the system or by the user (using the corresponding settings button) to restore space.

The second is for persistent files. In any case, you should consider the documentation considerations regarding the directory returned by getExternalCacheDir() .

+6
source

All Articles