What is the ideal place for image caching?

I extract a lot of thumbnails in my application from a remote server and lazily load them as a list.

Image capture starts in the AsynTask background and upon completion, the extracted images are saved in the HashMap using SoftReferences.

This works fine, but when the images in the cache receive GCd, you need to reload.

I could save them on the SD card so that there would be no re-fetching.

But I did not use this approach because of the mess that it would create on the SD card.

Are there any alternatives to these sortings, for example temporary folders, which can be cleared when the action / application ends / exits?

What is the β€œideal place” for image caching? Any tips, sample projects or pointers would be appreciated.

+1
source share
2 answers

You should check the file storage settings:
http://developer.android.com/guide/topics/data/data-storage.html
Files are saved in the application directory, so there is no place anywhere. Files will be deleted using the application. You can also implement some method that will clear the cache when the application starts (for example, delete files older than 2 weeks).

+5
source

SQLite DB SD-. /-, . , openOrCreateDatabase (String path, SQLiteDatabase.CursorFactory factory). , , , .
: http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html

0

Source: https://habr.com/ru/post/1751365/


All Articles