Android is using Picasso.
I have set OkHttpDownloader for picasso and use it.
I have a question.
Looking at the internal logic, it seems that the picasso-cache
folder is being cached under the cache
folder.
If I ask you a question here,
1. I wonder what criteria the file name is based on.
ex)
bc58db106dfbdbf4dc8686589b160ec4.1
bc58db106dfbdbf4dc8686589b160ec4.0
File name is Cache by OkHttp.It appears to be generated by a function called urlToKey()
in java. I don't think it would be too much to understand that the source of the file name is image url.
private static String urlToKey(Request request) {
return Util.md5Hex(request.url().toString());
}
You said you wanted to use the files stored in the disk cache. If you are using Picasso to load an image, you are already using this file internally. Picasso's internal cache logic processes the image to be read from memory or read from disk.
For example, loading the image http://a.jpg through Picasso will save it to memory and disk cache, and utilize memory and file cache the next time you load the image. Therefore, if you want to use the downloaded file, simply load the image with the same url.
© 2024 OneMinuteCode. All rights reserved.