4

1)The default implementation of the disc based cache present in android -volley is allocated a total memory of 5MB .

2)But the app Iam developing contains a lot of images .So I want to increase the size of the memory allocated by disc based cache .

3)So I want to increase the size of the cache ..I can simple do it by changing the value of DEFAULT_DISK_USAGE_BYTES inside Diskbasedcache.java file .

4)But I want to allocate memory based on the amount of space available in the disc ???Is there any way to implement it ??

user2391218
  • 412
  • 6
  • 17

1 Answers1

4

Few thoughts about Volley cache:

Using a disk based L1 cache may cause i/o blocking issues. Volley already has an implicit disk L2 cache. BitmapLruImageCache is a basic "least recently used" in memory cache implementation. It is fast and does not block I/O. This is the recommended approach.

I recommend you to play around this L1 cache for Volley

for tweaking the size have a look at this:

RequestQueue volleyQueue = Volley.newRequestQueue(this);
DiskBasedCache cache = new DiskBasedCache(getCacheDir(), 16 * 1024 * 1024);
volleyQueue = new RequestQueue(cache, new BasicNetwork(new HurlStack()));
volleyQueue.start();

Ref: Volley cache other ref about volley cache http://www.jayway.com/2013/10/04/image-caching-with-volley/

LOG_TAG
  • 19,894
  • 12
  • 72
  • 105