what is the best way to fix the size of the disc based cache ??android -volley

前端 未结 1 448
暗喜
暗喜 2021-01-19 03:53

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

相关标签:
1条回答
  • 2021-01-19 04:53

    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/

    0 讨论(0)
提交回复
热议问题