//
if (key instanceof PortalKey) {
// This code seems complex but actually it tries to find all objects in cache that have the same
// owner key than the portal key, for instance if we remove (portal,classic) then all pages
// related to (portal,classic) are also evicted
final PortalKey portalKey = (PortalKey) key;
try {
cache.select(new CachedObjectSelector<ScopedKey<?>, Object>() {
public boolean select(ScopedKey<?> selectedGlobalKey, ObjectCacheInfo<?> ocinfo) {
if (globalKey.getScope().equals(selectedGlobalKey.getScope())) {
Serializable selectedLocalKey = selectedGlobalKey.getKey();
if (selectedLocalKey instanceof OwnerKey) {
OwnerKey selectedOwnerKey = (OwnerKey) selectedLocalKey;
if (selectedOwnerKey.getType().equals(portalKey.getType())
&& selectedOwnerKey.getId().equals(portalKey.getId())) {
return true;
}
}
}
return false;