net.tsz.afinal.common
类 MemoryLruCache<K,V>

java.lang.Object
  继承者 net.tsz.afinal.common.MemoryLruCache<K,V>

public class MemoryLruCache<K,V>
extends java.lang.Object


构造方法摘要
MemoryLruCache(int maxSize)
           
 
方法摘要
 int createCount()
          Returns the number of times create(Object) returned a value.
 void evictAll()
          Clear the cache, calling entryRemoved(boolean, K, V, V) on each removed entry.
 int evictionCount()
          Returns the number of values that have been evicted.
 V get(K key)
          Returns the value for key if it exists in the cache or can be created by #create.
 int hitCount()
          Returns the number of times get(K) returned a value.
 int maxSize()
          For caches that do not override sizeOf(K, V), this returns the maximum number of entries in the cache.
 int missCount()
          Returns the number of times get(K) returned null or required a new value to be created.
 V put(K key, V value)
          Caches value for key.
 int putCount()
          Returns the number of times put(K, V) was called.
 V remove(K key)
          Removes the entry for key if it exists.
 int size()
          For caches that do not override sizeOf(K, V), this returns the number of entries in the cache.
 java.util.Map<K,V> snapshot()
          Returns a copy of the current contents of the cache, ordered from least recently accessed to most recently accessed.
 java.lang.String toString()
           
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

MemoryLruCache

public MemoryLruCache(int maxSize)
参数:
maxSize - for caches that do not override sizeOf(K, V), this is the maximum number of entries in the cache. For all other caches, this is the maximum sum of the sizes of the entries in this cache.
方法详细信息

get

public final V get(K key)
Returns the value for key if it exists in the cache or can be created by #create. If a value was returned, it is moved to the head of the queue. This returns null if a value is not cached and cannot be created.


put

public final V put(K key,
                   V value)
Caches value for key. The value is moved to the head of the queue.

返回:
the previous value mapped by key.

remove

public final V remove(K key)
Removes the entry for key if it exists.

返回:
the previous value mapped by key.

evictAll

public final void evictAll()
Clear the cache, calling entryRemoved(boolean, K, V, V) on each removed entry.


size

public final int size()
For caches that do not override sizeOf(K, V), this returns the number of entries in the cache. For all other caches, this returns the sum of the sizes of the entries in this cache.


maxSize

public final int maxSize()
For caches that do not override sizeOf(K, V), this returns the maximum number of entries in the cache. For all other caches, this returns the maximum sum of the sizes of the entries in this cache.


hitCount

public final int hitCount()
Returns the number of times get(K) returned a value.


missCount

public final int missCount()
Returns the number of times get(K) returned null or required a new value to be created.


createCount

public final int createCount()
Returns the number of times create(Object) returned a value.


putCount

public final int putCount()
Returns the number of times put(K, V) was called.


evictionCount

public final int evictionCount()
Returns the number of values that have been evicted.


snapshot

public final java.util.Map<K,V> snapshot()
Returns a copy of the current contents of the cache, ordered from least recently accessed to most recently accessed.


toString

public final java.lang.String toString()
覆盖:
java.lang.Object 中的 toString