Note that there are some explanatory texts on larger screens.

plurals
  1. PONon-blocking file cache (BitmapLruCache) implementation?
    primarykey
    data
    text
    <p>I am trying to create a simple demo for the <a href="https://android.googlesource.com/platform/frameworks/volley/+/master/src/com/android/volley/toolbox/ImageLoader.java" rel="nofollow">ImageLoader</a> functionality for the <a href="https://android.googlesource.com/platform/frameworks/volley" rel="nofollow">Android Volley Framework</a>. Constructor is the following:</p> <pre><code>public ImageLoader(RequestQueue queue, ImageCache imageCache) </code></pre> <p>The problem is with the <code>ImageCache</code>. Its JavaDoc states:</p> <blockquote> <p>Simple cache adapter interface. If provided to the ImageLoader, it will be used as an L1 cache before dispatch to Volley. Implementations must not block. Implementation with an LruCache is recommended.</p> </blockquote> <ol> <li>What exactly the 'Implementations must not block' in this context means?</li> <li>Is there an example of non-blocking file cache (even non-android but "pure" java) which I can use to educate my self how to convert my existing file cache to be non-blocking? </li> <li><p>If no such exist - what may be the negative implications of using my existing implementation which is (just the reading from the file):</p> <p>public byte[] get(String filename) {</p> <pre><code>byte[] ret = null; if (filesCache.containsKey(filename)) { FileInfo fi = filesCache.get(filename); BufferedInputStream input; String path = cacheDir + "/" + fi.getStorageFilename(); try { File file = new File(path); if (file.exists()) { input = new BufferedInputStream(new FileInputStream(file)); ret = IOUtils.toByteArray(input); input.close(); } else { KhandroidLog.e("Cannot find file " + path); } } catch (FileNotFoundException e) { filesCache.remove(filename); KhandroidLog.e("Cannot find file: " + path); } catch (IOException e) { KhandroidLog.e(e.getMessage()); } } return ret; </code></pre> <p>}</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload