com.nostra13.universalimageloader.cache.memory
Class BaseMemoryCache<K,V>

java.lang.Object
  extended by com.nostra13.universalimageloader.cache.memory.BaseMemoryCache<K,V>
All Implemented Interfaces:
MemoryCacheAware<K,V>
Direct Known Subclasses:
LimitedMemoryCache, WeakMemoryCache

public abstract class BaseMemoryCache<K,V>
extends java.lang.Object
implements MemoryCacheAware<K,V>

Base memory cache. Implements common functionality for memory cache. Provides object references ( not strong) storing.

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

Constructor Summary
BaseMemoryCache()
           
 
Method Summary
 void clear()
          Remove all items from cache
protected abstract  java.lang.ref.Reference<V> createReference(V value)
          Creates not strong reference of value
 V get(K key)
          Returns value by key.
 java.util.Collection<K> keys()
          Returns all keys of cache
 boolean put(K key, V value)
          Puts value into cache by key
 void remove(K key)
          Removes item by key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseMemoryCache

public BaseMemoryCache()
Method Detail

get

public V get(K 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<K,V>

put

public boolean put(K key,
                   V value)
Description copied from interface: MemoryCacheAware
Puts value into cache by key

Specified by:
put in interface MemoryCacheAware<K,V>
Returns:
true - if value was put into cache successfully, false - if value was not put into cache

remove

public void remove(K key)
Description copied from interface: MemoryCacheAware
Removes item by key

Specified by:
remove in interface MemoryCacheAware<K,V>

keys

public java.util.Collection<K> keys()
Description copied from interface: MemoryCacheAware
Returns all keys of cache

Specified by:
keys in interface MemoryCacheAware<K,V>

clear

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

Specified by:
clear in interface MemoryCacheAware<K,V>

createReference

protected abstract java.lang.ref.Reference<V> createReference(V value)
Creates not strong reference of value



Copyright © 2011-2013. All Rights Reserved.