@Test public void testSimpleCaseXML() { CacheManager manager = new CacheManager(); manager.removeAllCaches(); manager.shutdown(); CacheManager cacheManager = new CacheManager(getClass().getResourceAsStream ("/ehcache-refresh-ahead-simple.xml")); Ehcache decorator=cacheManager.getEhcache("testRefreshAhead1"); decorator.put(new Element(new Integer(1), new String("1"))); decorator.put(new Element(new Integer(2), new String("2"))); decorator.put(new Element(new Integer(3), new String("3"))); decorator.put(new Element(new Integer(4), new String("4"))); Element got = decorator.get(new Integer(1)); long creationTime = got.getCreationTime(); Assert.assertNotNull(got); sleepySeconds(1); got = decorator.get(new Integer(1)); Assert.assertNotNull(got); Assert.assertEquals(got.getCreationTime(), creationTime); sleepySeconds(7); got = decorator.get(new Integer(1)); Assert.assertNotNull(got); sleepySeconds(1); got = decorator.get(new Integer(1)); Assert.assertFalse(creationTime == got.getCreationTime()); 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);  }