P
P
prizrak392019-02-06 22:42:33
Java
prizrak39, 2019-02-06 22:42:33

How to correctly load and cache images?

Hello.
There is a mobile application in which you need to upload a large number of images. I know that Android uses either Picasso or Glide for this purpose.
The first question is, can these libraries upload data via FTP? And in general, how can you store images on the server, what can you get from HTTP?
The second point is that if I download an image from the server for a certain number of devices, then it will be read from disk every time (if the image is not cached on the device side). It turns out that it is necessary to additionally cache images on the server side, that is, store the most used images in the OP? Are there such boxed solutions or do they need to be implemented independently.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
101-s, 2019-02-07
@101-s

can data libraries upload data via FTP protocol?
I don’t know these libraries very well, but the approach itself seems not very reasonable to me, it turns out that the application uses a login and password, which is not buzzing.
nothing needs to be cached on the server side, Glide caches the image on the user side, and by default uses as many as 4 cache layers
By default, Glide checks multiple layers of caches before starting a new request for an image:
Active resources - Is this image displayed in another view right now?
Memory cache - Was this image recently loaded and still in memory?
Resource - Has this image been decoded, transformed, and written to the disk cache before?
Data - Was the data this image was obtained from written to the disk cache before?
From the docs: https://bumptech.github.io/glide/doc/caching.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question