Vishal Vishal - 1 year ago 205
Java Question

How to clear ehcache without server restart

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.

Answer Source

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 a clearAll() operation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download