com.bumptech.glide.load.engine.cache
Class MemoryCacheAdapter

java.lang.Object
  extended by com.bumptech.glide.load.engine.cache.MemoryCacheAdapter
All Implemented Interfaces:
MemoryCache

public class MemoryCacheAdapter
extends Object
implements MemoryCache

A simple class that ignores all puts and returns null for all gets.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bumptech.glide.load.engine.cache.MemoryCache
MemoryCache.ResourceRemovedListener
 
Constructor Summary
MemoryCacheAdapter()
           
 
Method Summary
 void clearMemory()
          Evict all items from the memory cache.
 EngineResource<?> put(Key key, EngineResource<?> resource)
          Add bitmap to the cache with the given key.
 EngineResource<?> remove(Key key)
          Removes the value for the given key and returns it if present or null otherwise.
 void setResourceRemovedListener(MemoryCache.ResourceRemovedListener listener)
          Set the listener to be called when a bitmap is removed from the cache.
 void setSizeMultiplier(float multiplier)
          Adjust the maximum size of the cache by multiplying the original size of the cache by the given multiplier.
 void trimMemory(int level)
          Trim the memory cache to the appropriate level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryCacheAdapter

public MemoryCacheAdapter()
Method Detail

setSizeMultiplier

public void setSizeMultiplier(float multiplier)
Description copied from interface: MemoryCache
Adjust the maximum size of the cache by multiplying the original size of the cache by the given multiplier.

If the size multiplier causes the size of the cache to be decreased, items will be evicted until the cache is smaller than the new size.

Specified by:
setSizeMultiplier in interface MemoryCache
Parameters:
multiplier - A size multiplier >= 0.

remove

public EngineResource<?> remove(Key key)
Description copied from interface: MemoryCache
Removes the value for the given key and returns it if present or null otherwise.

Specified by:
remove in interface MemoryCache
Parameters:
key - The key.

put

public EngineResource<?> put(Key key,
                             EngineResource<?> resource)
Description copied from interface: MemoryCache
Add bitmap to the cache with the given key.

Specified by:
put in interface MemoryCache
Parameters:
key - The key to retrieve the bitmap.
resource - The EngineResource to store.
Returns:
The old value of key (null if key is not in map).

setResourceRemovedListener

public void setResourceRemovedListener(MemoryCache.ResourceRemovedListener listener)
Description copied from interface: MemoryCache
Set the listener to be called when a bitmap is removed from the cache.

Specified by:
setResourceRemovedListener in interface MemoryCache
Parameters:
listener - The listener.

clearMemory

public void clearMemory()
Description copied from interface: MemoryCache
Evict all items from the memory cache.

Specified by:
clearMemory in interface MemoryCache

trimMemory

public void trimMemory(int level)
Description copied from interface: MemoryCache
Trim the memory cache to the appropriate level. Typically called on the callback onTrimMemory.

Specified by:
trimMemory in interface MemoryCache
Parameters:
level - This integer represents a trim level as specified in ComponentCallbacks2.