@Test public void testSimpleCaseXML() { CacheManager cacheManager = new CacheManager(getClass().getResourceAsStream ("/ehcache-refresh-ahead-simple.xml")); try { final Ehcache decorator = cacheManager.getEhcache("testRefreshAhead1"); final Integer key1 = 1; decorator.put(new Element(key1, "1")); decorator.put(new Element(2, "2")); decorator.put(new Element(3, "3")); decorator.put(new Element(4, "4")); Element got = decorator.get(key1); long creationTime = got.getCreationTime(); assertNotNull(got); sleepFor(1, TimeUnit.SECONDS); got = decorator.get(key1); assertNotNull(got); assertEquals(got.getCreationTime(), creationTime); assertBy(5, TimeUnit.SECONDS, new Callable<Element>() { @Override public Element call() throws Exception { return decorator.get(key1); } }, not(sameInstance(got))); got = decorator.get(key1); assertFalse(creationTime == got.getCreationTime()); } finally { cacheManager.shutdown(); } }
@Override public Element get(Object key) throws IllegalStateException, CacheException { Element elem = super.get(key); possiblyTriggerRefresh(elem, refreshAheadConfig.getTimeToRefreshMillis()); return elem; }
RefreshAheadCache extends EhcacheDecoratorAdapter { @Override public Element get(Object key) throws IllegalStateException, CacheException { Element elem = super.get(key); possiblyTriggerRefresh(elem, refreshAheadConfig.getTimeToRefreshMillis()); return elem; } }
RefreshAheadCache extends EhcacheDecoratorAdapter { @Override public Element get(Object key) throws IllegalStateException, CacheException { Element elem = super.get(key); possiblyTriggerRefresh(elem, refreshAheadConfig.getTimeToRefreshMillis()); return elem; } RefreshAheadCache(Ehcache adaptedCache, RefreshAheadCacheConfiguration refreshConfig); }
RefreshAheadCache extends EhcacheDecoratorAdapter { @Override public Element get(Object key) throws IllegalStateException, CacheException { Element elem = super.get(key); possiblyTriggerRefresh(elem, refreshAheadConfig.getTimeToRefreshMillis()); return elem; } RefreshAheadCache(Ehcache adaptedCache, RefreshAheadCacheConfiguration refreshConfig); @Override Element get(Object key); @Override Element get(Serializable key); @org.terracotta.statistics.Statistic(name = "refreshed", tags = "refreshahead") long getRefreshSuccessCount(); @Override String getName(); @org.terracotta.statistics.Statistic(name = "offered", tags = "refreshahead") long getOfferCount(); @org.terracotta.statistics.Statistic(name = "dropped", tags = "refreshahead") long getDroppedCount(); @org.terracotta.statistics.Statistic(name = "processed", tags = "refreshahead") long getProcessedCount(); @org.terracotta.statistics.Statistic(name = "backlog", tags = "refreshahead") long getBacklogCount(); static Set<ExtendedStatistics.Statistic<Number>> findRefreshedStatistic(Ehcache cache); static Set<ExtendedStatistics.Statistic<Number>> findOfferStatistic(Ehcache cache); static Set<ExtendedStatistics.Statistic<Number>> findDroppedStatistic(Ehcache cache); static Set<ExtendedStatistics.Statistic<Number>> findProcessedStatistic(Ehcache cache); static Set<ExtendedStatistics.Statistic<Number>> findBacklogStatistic(Ehcache cache); }
RefreshAheadCache extends EhcacheDecoratorAdapter { @Override public Element get(Object key) throws IllegalStateException, CacheException { Element elem = super.get(key); possiblyTriggerRefresh(elem, refreshAheadConfig.getTimeToRefreshMillis()); return elem; } RefreshAheadCache(Ehcache adaptedCache, RefreshAheadCacheConfiguration refreshConfig); @Override Element get(Object key); @Override Element get(Serializable key); @org.terracotta.statistics.Statistic(name = "refreshed", tags = "refreshahead") long getRefreshSuccessCount(); @Override String getName(); @org.terracotta.statistics.Statistic(name = "offered", tags = "refreshahead") long getOfferCount(); @org.terracotta.statistics.Statistic(name = "dropped", tags = "refreshahead") long getDroppedCount(); @org.terracotta.statistics.Statistic(name = "processed", tags = "refreshahead") long getProcessedCount(); @org.terracotta.statistics.Statistic(name = "backlog", tags = "refreshahead") long getBacklogCount(); static Set<ExtendedStatistics.Statistic<Number>> findRefreshedStatistic(Ehcache cache); static Set<ExtendedStatistics.Statistic<Number>> findOfferStatistic(Ehcache cache); static Set<ExtendedStatistics.Statistic<Number>> findDroppedStatistic(Ehcache cache); static Set<ExtendedStatistics.Statistic<Number>> findProcessedStatistic(Ehcache cache); static Set<ExtendedStatistics.Statistic<Number>> findBacklogStatistic(Ehcache cache);  }