com.nostra13.universalimageloader.cache.memory.impl
Class UsingFreqLimitedMemoryCache

java.lang.Object
  extended by com.nostra13.universalimageloader.cache.memory.BaseMemoryCache
      extended by com.nostra13.universalimageloader.cache.memory.LimitedMemoryCache
          extended by com.nostra13.universalimageloader.cache.memory.impl.UsingFreqLimitedMemoryCache
All Implemented Interfaces:
MemoryCache, MemoryCacheAware<String,android.graphics.Bitmap>

public class UsingFreqLimitedMemoryCache
extends LimitedMemoryCache

Limited bitmap cache. Provides bitmaps storing. Size of all stored bitmaps will not to exceed size limit. When cache reaches limit size then the bitmap which used the least frequently is deleted from cache.

NOTE: This cache uses strong and weak references for stored Bitmaps. Strong references - for limited count of Bitmaps (depends on cache size), weak references - for all other cached Bitmaps.

Since:
1.0.0
Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)

Constructor Summary
UsingFreqLimitedMemoryCache(int sizeLimit)
           
 
Method Summary
 void clear()
          Remove all items from cache
protected  Reference<android.graphics.Bitmap> createReference(android.graphics.Bitmap value)
          Creates not strong reference of value
 android.graphics.Bitmap get(String key)
          Returns value by key.
protected  int getSize(android.graphics.Bitmap value)
           
 boolean put(String key, android.graphics.Bitmap value)
          Puts value into cache by key
 android.graphics.Bitmap remove(String key)
          Removes item by key
protected  android.graphics.Bitmap removeNext()
           
 
Methods inherited from class com.nostra13.universalimageloader.cache.memory.LimitedMemoryCache
getSizeLimit
 
Methods inherited from class com.nostra13.universalimageloader.cache.memory.BaseMemoryCache
keys
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsingFreqLimitedMemoryCache

public UsingFreqLimitedMemoryCache(int sizeLimit)
Method Detail

put

public boolean put(String key,
                   android.graphics.Bitmap value)
Description copied from interface: MemoryCacheAware
Puts value into cache by key

Specified by:
put in interface MemoryCacheAware<String,android.graphics.Bitmap>
Overrides:
put in class LimitedMemoryCache
Returns:
true - if value was put into cache successfully, false - if value was not put into cache

get

public android.graphics.Bitmap get(String key)
Description copied from interface: MemoryCacheAware
Returns value by key. If there is no value for key then null will be returned.

Specified by:
get in interface MemoryCacheAware<String,android.graphics.Bitmap>
Overrides:
get in class BaseMemoryCache

remove

public android.graphics.Bitmap remove(String key)
Description copied from interface: MemoryCacheAware
Removes item by key

Specified by:
remove in interface MemoryCacheAware<String,android.graphics.Bitmap>
Overrides:
remove in class LimitedMemoryCache

clear

public void clear()
Description copied from interface: MemoryCacheAware
Remove all items from cache

Specified by:
clear in interface MemoryCacheAware<String,android.graphics.Bitmap>
Overrides:
clear in class LimitedMemoryCache

getSize

protected int getSize(android.graphics.Bitmap value)
Specified by:
getSize in class LimitedMemoryCache

removeNext

protected android.graphics.Bitmap removeNext()
Specified by:
removeNext in class LimitedMemoryCache

createReference

protected Reference<android.graphics.Bitmap> createReference(android.graphics.Bitmap value)
Description copied from class: BaseMemoryCache
Creates not strong reference of value

Specified by:
createReference in class BaseMemoryCache


Copyright © 2011-2014. All Rights Reserved.