Package org.archive.wayback.accesscontrol.robotstxt.redis.RedisRobotsLogic

Examples of org.archive.wayback.accesscontrol.robotstxt.redis.RedisRobotsLogic.RedisValue


        LiveWebCacheUnavailableException, LiveWebTimeoutException,
        IOException {
   
    String url = urlURL.toExternalForm();
   
    RedisValue value = null;
   
    try {
      PerfStats.timeStart(PerfStat.RobotsRedis);
     
      if (redisCmds != null) {
        value = redisCmds.getValue(url);
      }
    } catch (LiveWebCacheUnavailableException lw) {
      value = null;
    } finally {
      PerfStats.timeEnd(PerfStat.RobotsRedis);
    }
   
    // Use the old liveweb cache, if provided
    if (value == null) {
      RobotsResult result = loadExternal(urlURL, maxCacheMS, bUseOlder);
     
      PerfStats.timeStart(PerfStat.RobotsRedis);
      this.updateCache(result.robots, url, null, result.status, true);
      PerfStats.timeEnd(PerfStat.RobotsRedis);
     
      if (result == null || result.status != STATUS_OK) {
        throw new LiveDocumentNotAvailableException("Error Loading Live Robots")
      }
     
      return new RobotsTxtResource(result.robots);
     
    } else {
     
      if (isExpired(value, url, 0)) {
        PerfStats.timeStart(PerfStat.RobotsRedis);       
        redisCmds.pushKey(UPDATE_QUEUE_KEY, url, MAX_UPDATE_QUEUE_SIZE);
        PerfStats.timeEnd(PerfStat.RobotsRedis);
      }
     
      String currentRobots = value.value;
     
      if (currentRobots.startsWith(ROBOTS_TOKEN_ERROR)) {
        throw new LiveDocumentNotAvailableException("Robots Error: " + currentRobots)
      } else if (value.equals(ROBOTS_TOKEN_EMPTY)) {
        currentRobots = "";
      }
     
      return new RobotsTxtResource(currentRobots)
    }
View Full Code Here


          LOGGER.info("REFRESH ERROR: " + status + " - Keeping same robots for " + url);
        }
      }
    }
       
    final RedisValue value = new RedisValue((ttlOnly ? null : newRedisValue), newTTL);
   
    redisCmds.updateValue(url, value, gzipRobots);
  }
View Full Code Here

  public RobotsResult forceUpdate(String url, int minUpdateTime, boolean cacheFails)
  {
    String current = null;
   
    try {
      RedisValue value = null;
     
      try {
        PerfStats.timeStart(PerfStat.RobotsRedis);
        value = redisCmds.getValue(url);
      } finally {
View Full Code Here

TOP

Related Classes of org.archive.wayback.accesscontrol.robotstxt.redis.RedisRobotsLogic.RedisValue

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.