Created
July 19, 2013 12:54
-
-
Save husrevo/6038912 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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