Though I guess its highly unlikely - but is there any way to clear the ehcache without restarting the server? I need to clear the cache for some testing - I cannot change the code and cannot afford to restart server at multiple times.
PS: I am using apache-tomcat-5.5.25 Please let me know. Thanks, psvm
Do you expose Ehcache via JMX? Then you could clear the cache using JMX operations by using a tool like e.g. jvisualvm. Look for MBeans like
net.sf.ehcache.CacheManager
which provide aclearAll()
operation.Using spring+hibernate and exposing mbean:
XML Config:
And then connect to the java process using jconsole and use Mbean method invocation - to clear the second level cache!