mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
[RM-7162] Added validations to prevent having a cached empty set
This commit is contained in:
@@ -34,7 +34,6 @@ import org.alfresco.repo.cache.SimpleCache;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,7 +76,17 @@ public class RMContainerCacheManager implements RecordsManagementModel
|
|||||||
*/
|
*/
|
||||||
public boolean isCached(StoreRef storeRef)
|
public boolean isCached(StoreRef storeRef)
|
||||||
{
|
{
|
||||||
return cache.contains(getKey(storeRef));
|
boolean isCached = true;
|
||||||
|
Pair<StoreRef, String> key = getKey(storeRef);
|
||||||
|
Set<NodeRef> values = cache.get(key);
|
||||||
|
if (values == null || values.size() == 0)
|
||||||
|
{
|
||||||
|
if (values != null) {
|
||||||
|
cache.remove(key);
|
||||||
|
}
|
||||||
|
isCached = false;
|
||||||
|
}
|
||||||
|
return isCached;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,9 +126,12 @@ public class RMContainerCacheManager implements RecordsManagementModel
|
|||||||
entries.add(nodeRef);
|
entries.add(nodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entries.size() > 0)
|
||||||
|
{
|
||||||
cache.put(key, entries);
|
cache.put(key, entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the supplied entry from the cache
|
* Removes the supplied entry from the cache
|
||||||
@@ -136,6 +148,9 @@ public class RMContainerCacheManager implements RecordsManagementModel
|
|||||||
if (cache.contains(key))
|
if (cache.contains(key))
|
||||||
{
|
{
|
||||||
cache.get(key).remove(nodeRef);
|
cache.get(key).remove(nodeRef);
|
||||||
|
if (cache.get(key).size() == 0) {
|
||||||
|
cache.remove(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user