mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user