Added cache-only getValue() operation

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20786 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-06-24 00:59:19 +00:00
parent 325f8e7923
commit a471f2d729

View File

@@ -528,6 +528,37 @@ public class EntityLookupCache<K extends Serializable, V extends Object, VK exte
return updateCount;
}
/**
* Cache-only operation: Get the value for a given key
*
* @param key The entity key, which may be valid or invalid (<tt>null</tt> not allowed)
* @return The new entity value (may be <tt>null</tt>)
*/
@SuppressWarnings("unchecked")
public V getValue(K key)
{
CacheRegionKey keyCacheKey = new CacheRegionKey(cacheRegion, key);
// Look in the cache
V value = (V) cache.get(keyCacheKey);
if (value == null)
{
return null;
}
else if (value.equals(VALUE_NOT_FOUND))
{
// We checked before
return null;
}
else if (value.equals(VALUE_NULL))
{
return null;
}
else
{
return value;
}
}
/**
* Cache-only operation: Update the cache's value
*