Ejemplo n.º 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;
  }
Ejemplo n.º 2
0
  public static synchronized void clear() throws Exception {
    if (cache != null) {
      cache.clear();
    }

    setCacheDate(null);
  }
Ejemplo n.º 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;
  }