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

This commit is contained in:
Juergen Hoeller 2011-11-28 15:05:53 +00:00
parent 61a5ab9d34
commit a09a0316b7
1 changed files with 26 additions and 0 deletions

View File

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