added "disabled" property to EhCacheFactoryBean
This commit is contained in:
parent
b0a6ebfb61
commit
c07eb6bb9a
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2009 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -99,6 +99,8 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
|
||||||
|
|
||||||
private Set<CacheEventListener> cacheEventListeners;
|
private Set<CacheEventListener> cacheEventListeners;
|
||||||
|
|
||||||
|
private boolean disabled = false;
|
||||||
|
|
||||||
private String beanName;
|
private String beanName;
|
||||||
|
|
||||||
private Ehcache cache;
|
private Ehcache cache;
|
||||||
|
|
@ -266,6 +268,14 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
|
||||||
this.cacheEventListeners = cacheEventListeners;
|
this.cacheEventListeners = cacheEventListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether this cache should be marked as disabled.
|
||||||
|
* @see net.sf.ehcache.Cache#setDisabled
|
||||||
|
*/
|
||||||
|
public void setDisabled(boolean disabled) {
|
||||||
|
this.disabled = disabled;
|
||||||
|
}
|
||||||
|
|
||||||
public void setBeanName(String name) {
|
public void setBeanName(String name) {
|
||||||
this.beanName = name;
|
this.beanName = name;
|
||||||
}
|
}
|
||||||
|
|
@ -331,7 +341,9 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
|
||||||
cache.getCacheEventNotificationService().registerListener(listener);
|
cache.getCacheEventNotificationService().registerListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.disabled) {
|
||||||
|
cache.setDisabled(true);
|
||||||
|
}
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue