上一节涉及到了memorycatche,那么现在我们就看看MemoryCatche是如何实现的。
源码:
/**
* Interface for memory cache
*
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
* @since 1.9.2
*/
public interface MemoryCache {
/**
* Puts value into cache by key
*
* @return <b>true</b> - if value was put into cache successfully, <b>false</b> - if value was <b>not</b> put into
* cache
*/
boolean put(String key, Bitmap value);
/** Returns value by key. If there is no value for key then null will be returned. */
Bitmap get(String key);
/** Removes item by key */
Bitmap remove(String key);
/** Returns all keys of cache */
Collection<String> keys();
/** Remove all items from cache */
void clear();
}
这里看看就好,关键还是理悟其为什么设计这个接口,以及接口内容的定义为什么是这个样子的,能否在减少,或者是否适合增加,这其中的理解才是最重要的。
仁者见仁,智者见智,大家看看就过好了。