Skip to content

Instantly share code, notes, and snippets.

@husrevo
Created July 19, 2013 12:54
Show Gist options
  • Save husrevo/6038912 to your computer and use it in GitHub Desktop.
Save husrevo/6038912 to your computer and use it in GitHub Desktop.
public class ChainImageCache implements ImageCache {
private ImageCache fastCache, slowCache;
public ChainImageCache(ImageCache fastCache, ImageCache slowCache) {
this.fastCache = fastCache;
this.slowCache = slowCache;
}
@Override
public Bitmap getBitmap(String url) {
Bitmap b = fastCache.getBitmap(url);
if(b == null)
b = slowCache.getBitmap(url);
return b;
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
fastCache.putBitmap(url, bitmap);
slowCache.putBitmap(url, bitmap);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment