Disable Volley cache management

If you use any of the default Request classes implemented in volley(e.g. StringRequest, JsonRequest, etc.), then call setShouldCache(false) right before adding the request object to the volley RequestQueue:

request.setShouldCache(false);
myQueue.add(request);

If you have your own implementation of the Request class, then you can call setShouldCache(false) in the constructor of your class.

This solution disables caching for each requests individually. If you want to disable caching globally from the volley library, you can permanently set the mShouldCache variable to false in the Request class.

Leave a Comment