Package org.infoglue.deliver.util.ioqueue

Examples of org.infoglue.deliver.util.ioqueue.CachingIOResultHandler


          localCacheKey = cacheKey;

        if(logger.isInfoEnabled())
          logger.info("localCacheKey:" +localCacheKey);
       
        CachingIOResultHandler resultHandler = new CachingIOResultHandler();
        resultHandler.setCacheKey(localCacheKey);
        resultHandler.setCacheName(cacheName);
        resultHandler.setUseMemoryCache(useCache);
        resultHandler.setUseFileCacheFallback(useFileCacheFallback);
        resultHandler.setFileCacheCharEncoding(fileCacheCharEncoding);

        String cachedResult = null;
        boolean callInBackground = false;
       
        if(logger.isInfoEnabled())
          logger.info("Using some cache (useCache:" + useCache + ", useFileCacheFallback:" + useFileCacheFallback + ", cacheTimeout:" + cacheTimeout.intValue() + ")");

        cachedResult = (String)CacheController.getCachedObjectFromAdvancedCache(cacheName, localCacheKey, cacheTimeout.intValue(), useFileCacheFallback, fileCacheCharEncoding, useCache);
        if(logger.isInfoEnabled())
          t.printElapsedTime("Getting timed cache result:" + cachedResult);
       
        if(((cachedResult == null || cachedResult.equals(""))) && !skipExpiredContentFallback)
        {
          logger.info("No cached result either in memory or in filecache - getting old if exists");
          cachedResult = (String)CacheController.getCachedObjectFromAdvancedCache(cacheName, localCacheKey, useFileCacheFallback, fileCacheCharEncoding, useCache);
          getController().getDeliveryContext().setDisablePageCache(true);

          callInBackground = true;
        }
       
        if(cachedResult == null || cachedResult.equals(""))
        {
          if(logger.isInfoEnabled())
            logger.info("Calling url directly as last resort...");
         
          cachedResult = helper.getUrlContent(url, requestProperties, requestParameters, charEncoding, timeout.intValue());
         
          resultHandler.handleResult(cachedResult);
        }
        else if(callInBackground)
        {
          if(logger.isInfoEnabled())
            logger.info("Adding url to queue...");
View Full Code Here

TOP

Related Classes of org.infoglue.deliver.util.ioqueue.CachingIOResultHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.