I am new to work on Volley and on caching too :P. Though I have already gone through a number of articles & posts related to Image Caching with Volley but I am still not clear with the best/preferred way for Image Caching with Volley. Like disk caching or memory? What support does Volley already provide and how (related to L1 and L2 caching support)? I am using NetworkImageView in my case, to populate a list view with images to be fetched from net. Thanks in advance!
For image caching, volley expects you to provide an implementation memory cache for images. This cache is used during the up time of the app for quicker loading times using the memory.
Not related specifically to images, Volley has its own disk cache which it uses to cache EVERY response it gets, with the default strategy of caching according to cache headers of the HTTP response.
If the images you are loading in your app have cache headers, they will be cached according to them on the disk, otherwise the will not be.
If you're unhappy with this strategy and want to force disk caching, you'll have to edit / add a little code that changes the caching strategy. There are many ways to achieve this, one being providing your own implementation to parsing the HTTP headers. Take a look at HttpHeaderParser
in the Volley source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With