コード例 #1
0
  public static synchronized CampaignCache getCache(Date date) throws Exception {
    boolean reload = true;

    try {
      date = DateUtil.trunc(date);

      if (cache == null) {
        cache = new CampaignCache();
      } else if ((cacheDate == null) || !cacheDate.equals(date)) {
        cache.clear();
      } else {
        reload = false;
      }

      if (reload) {
        cache.loadCache();

        cacheDate = date;
      }
    } catch (Exception e) {
      cache = null;
      cacheDate = null;

      throw e;
    }

    return cache;
  }
コード例 #2
0
  public static synchronized void clear() throws Exception {
    if (cache != null) {
      cache.clear();
    }

    setCacheDate(null);
  }
コード例 #3
0
  public static synchronized CampaignCache loadCache(Date date) throws Exception {
    try {
      date = DateUtil.trunc(date);

      if (cache != null) {
        cache.clear();
      } else {
        cache = new CampaignCache();
      }
      cache.loadCache();

      cacheDate = date;
    } catch (Exception e) {
      cache = null;
      cacheDate = null;

      throw e;
    }

    return cache;
  }