code: private ResponseWrapper fetchContentFromCacheIfAvailable(
              final RenderRequest req, final String serviceUrl) {
  
          ResponseWrapper rslt = null; // default
  
          final List<CacheTuple> cacheKeysToTry = new ArrayList<>();
          // Don't use private-scope caching for anonymous users
          if (req.getRemoteUser() != null) {
              cacheKeysToTry.add(
                      // Private-scope cache key
                      new CacheTuple(
                              serviceUrl,
                              req.getPortletMode().toString(),
                              req.getWindowState().toString(),
                              req.getRemoteUser()));
          }
          cacheKeysToTry.add(
                  // Public-scope cache key
                  new CacheTuple(
                          serviceUrl,
                          req.getPortletMode().toString(),
                          req.getWindowState().toString()));
  
          for (CacheTuple key : cacheKeysToTry) {
              final Element cacheElement = this.responseCache.get(key);
              if (cacheElement != null) {
                  rslt = (ResponseWrapper) cacheElement.getObjectValue();
                  break;
              }
          }
  
          return rslt;
      }
docs: /*
  Implementation