code: @SuppressWarnings("unchecked")
      protected <D extends CachedPortletResultHolder<T>, T extends Serializable>
              CacheState<D, T> getPortletCacheState(
                      HttpServletRequest request,
                      IPortletWindow portletWindow,
                      PublicPortletCacheKey publicCacheKey,
                      Ehcache publicOutputCache,
                      Ehcache privateOutputCache) {
  
          final CacheState<D, T> cacheState = new CacheState<D, T>();
          cacheState.setPublicPortletCacheKey(publicCacheKey);
  
          final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
  
          // Check for publicly cached data
          D cachedPortletData =
                  (D) this.getCachedPortletData(publicCacheKey, publicOutputCache, portletWindow);
          if (cachedPortletData != null) {
              cacheState.setCachedPortletData(cachedPortletData);
              return cacheState;
          }
  
          // Generate private cache key
          final HttpSession session = request.getSession();
          final String sessionId = session.getId();
          final IPortletEntityId entityId = portletWindow.getPortletEntityId();
          final PrivatePortletCacheKey privateCacheKey =
                  new PrivatePortletCacheKey(sessionId, portletWindowId, entityId, publicCacheKey);
          cacheState.setPrivatePortletCacheKey(privateCacheKey);
  
          // Check for privately cached data
          cachedPortletData =
                  (D) this.getCachedPortletData(privateCacheKey, privateOutputCache, portletWindow);
          if (cachedPortletData != null) {
              cacheState.setCachedPortletData(cachedPortletData);
              return cacheState;
          }
  
          return cacheState;
      }
docs: Get the cached portlet data looking in both the public and then private caches returning the
  first found
  
  @param request The current request
  @param portletWindow The window to get data for
  @param publicCacheKey The public cache key
  @param publicOutputCache The public cache
  @param privateOutputCache The private cache