public class UnrefedBitmapCache extends UnrefedPooledCache<RequestKey,ReusableBitmap> implements BitmapCache
poll()
if
nothing can be returned. This is useful if you know you will incur high costs upon receiving
nothing from the pool, and you do not want to incur those costs at the critical moment when the
UI is animating.
This subclass provides custom cache behavior. Null values can be cached. Later,
when the same key is used to retrieve the value, a ReusableBitmap.NullReusableBitmap
singleton will
be returned.Constructor and Description |
---|
UnrefedBitmapCache(int targetSizeBytes,
float nonPooledFraction,
int nullCapacity) |
Modifier and Type | Method and Description |
---|---|
ReusableBitmap |
get(RequestKey key,
boolean incrementRefCount) |
void |
offer(ReusableBitmap value) |
ReusableBitmap |
poll()
If
setBlocking(boolean) has been called with true, this method will block until a
resource is available. |
ReusableBitmap |
put(RequestKey key,
ReusableBitmap value)
Note: The cache only supports same-sized bitmaps.
|
void |
setBlocking(boolean blocking)
Declare that
poll() should now block until it can return something. |
protected int |
sizeOf(ReusableBitmap value) |
clear, toDebugString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, toDebugString
public UnrefedBitmapCache(int targetSizeBytes, float nonPooledFraction, int nullCapacity)
public void setBlocking(boolean blocking)
poll()
should now block until it can return something.setBlocking
in interface BitmapCache
protected int sizeOf(ReusableBitmap value)
sizeOf
in class UnrefedPooledCache<RequestKey,ReusableBitmap>
public ReusableBitmap poll()
setBlocking(boolean)
has been called with true, this method will block until a
resource is available.poll
in interface PooledCache<RequestKey,ReusableBitmap>
poll
in class UnrefedPooledCache<RequestKey,ReusableBitmap>
public void offer(ReusableBitmap value)
offer
in interface PooledCache<RequestKey,ReusableBitmap>
offer
in class UnrefedPooledCache<RequestKey,ReusableBitmap>
public ReusableBitmap get(RequestKey key, boolean incrementRefCount)
get
in interface PooledCache<RequestKey,ReusableBitmap>
get
in class UnrefedPooledCache<RequestKey,ReusableBitmap>
public ReusableBitmap put(RequestKey key, ReusableBitmap value)
put
in interface PooledCache<RequestKey,ReusableBitmap>
put
in class UnrefedPooledCache<RequestKey,ReusableBitmap>