Company company = PublicCompanyFactory.getDefaultCompany();
for ( Portlet portlet : portlets ) {
//PK
PortletPK id = portlet.getPrimaryKey();
//Cache key
String scpId = PortalUtil.class.getName() + "." + com.dotcms.repackage.javax.portlet.Portlet.class.getName();
if ( !portlet.isWARFile() ) {
scpId += "." + company.getCompanyId();
}
//Clean-up the caches
portletManager.removePortletFromPool( company.getCompanyId(), id.getPortletId() );
//Clean-up the caches
Map map = (Map) SimpleCachePool.get( scpId );
if ( map != null ) {
map.remove( portlet.getPortletId() );
}