exposed EHCache 1.7's "statisticsEnabled"/"sampledStatisticsEnabled" on EhCacheFactoryBean ()

master
Juergen Hoeller 13 years ago
parent 61a5ab9d34
commit a09a0316b7
  1. 26
      org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java

@ -99,6 +99,10 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
private Set<CacheEventListener> cacheEventListeners;
private boolean statisticsEnabled = false;
private boolean sampledStatisticsEnabled = false;
private boolean disabled = false;
private String beanName;
@ -268,6 +272,22 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
this.cacheEventListeners = cacheEventListeners;
}
/**
* Set whether to enable EhCache statistics on this cache.
* @see net.sf.ehcache.Cache#setStatisticsEnabled
*/
public void setStatisticsEnabled(boolean statisticsEnabled) {
this.statisticsEnabled = statisticsEnabled;
}
/**
* Set whether to enable EhCache's sampled statistics on this cache.
* @see net.sf.ehcache.Cache#setSampledStatisticsEnabled
*/
public void setSampledStatisticsEnabled(boolean sampledStatisticsEnabled) {
this.sampledStatisticsEnabled = sampledStatisticsEnabled;
}
/**
* Set whether this cache should be marked as disabled.
* @see net.sf.ehcache.Cache#setDisabled
@ -341,6 +361,12 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
cache.getCacheEventNotificationService().registerListener(listener);
}
}
if (this.statisticsEnabled) {
cache.setStatisticsEnabled(true);
}
if (this.sampledStatisticsEnabled) {
cache.setSampledStatisticsEnabled(true);
}
if (this.disabled) {
cache.setDisabled(true);
}

Loading…
Cancel
Save