// Path: src/com/ikantech/support/util/YiLRUMap.java
// @SuppressWarnings("serial")
// public class YiLRUMap<K, V> extends LinkedHashMap<K, V>
// {
// 	private int mCapacity;
// 
// 	public YiLRUMap(int initialCapacity)
// 	{
// 		super(initialCapacity, 0.75F, true);
// 		mCapacity = initialCapacity;
// 	}
// 
// 	@Override
// 	protected boolean removeEldestEntry(java.util.Map.Entry<K, V> eldest)
// 	{
// 		return size() > mCapacity;
// 	}
// }


import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import com.ikantech.support.util.YiLRUMap;
package com.ikantech.support.cache;



public abstract class InAbsCache<K, V>
{
	protected static final int DEFAULT_CACHE_SIZE = 32;

	private HashMap<K, V> mHardCache;

	/**
	 * 当mHardCache的key大于Cache Size的时候，会根据LRU算法把最近没有被使用的key放入到这个缓存中。
	 * T使用了SoftReference，当内存空间不足时，此cache中的T会被垃圾回收掉
	 */
	private ConcurrentHashMap<K, SoftReference<V>> mSoftCache;

	private int mCacheSize;

	@SuppressWarnings("serial")
	public InAbsCache(int cacheSize)
	{
		if (cacheSize < 1)
		{
			cacheSize = DEFAULT_CACHE_SIZE;
		}
		mCacheSize = cacheSize;
		mSoftCache = new ConcurrentHashMap<K, SoftReference<V>>(mCacheSize / 2);

// Path: src/com/ikantech/support/util/YiLRUMap.java
// @SuppressWarnings("serial")
// public class YiLRUMap<K, V> extends LinkedHashMap<K, V>
// {
// 	private int mCapacity;
// 
// 	public YiLRUMap(int initialCapacity)
// 	{
// 		super(initialCapacity, 0.75F, true);
// 		mCapacity = initialCapacity;
// 	}
// 
// 	@Override
// 	protected boolean removeEldestEntry(java.util.Map.Entry<K, V> eldest)
// 	{
// 		return size() > mCapacity;
// 	}
// }


// Path: src/com/ikantech/support/cache/InAbsCache.java
import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import com.ikantech.support.util.YiLRUMap;

package com.ikantech.support.cache;



public abstract class InAbsCache<K, V>
{
	protected static final int DEFAULT_CACHE_SIZE = 32;

	private HashMap<K, V> mHardCache;

	/**
	 * 当mHardCache的key大于Cache Size的时候，会根据LRU算法把最近没有被使用的key放入到这个缓存中。
	 * T使用了SoftReference，当内存空间不足时，此cache中的T会被垃圾回收掉
	 */
	private ConcurrentHashMap<K, SoftReference<V>> mSoftCache;

	private int mCacheSize;

	@SuppressWarnings("serial")
	public InAbsCache(int cacheSize)
	{
		if (cacheSize < 1)
		{
			cacheSize = DEFAULT_CACHE_SIZE;
		}
		mCacheSize = cacheSize;
		mSoftCache = new ConcurrentHashMap<K, SoftReference<V>>(mCacheSize / 2);

		mHardCache = new YiLRUMap<K, V>(mCacheSize)