final String tenantIdentifier = getTenantIdentifier();
if ( tenantIdentifier == null ) {
return new CacheKey( id, type, entityOrRoleName, getFactory() );
}
else {
return new TenantAwareCacheKey( id, type, entityOrRoleName, getFactory(), tenantIdentifier );
}
}