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; }
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; }