Clear all websphere portal dynacache (distributedmap) with one click

Sample code to inject in cachemonitor

We can clear all caches with single click by injecting the below small piece of code into the Cache Monitor JSP (WebSphere\wp_profile\installedApps\sivapcCell\Dynamic Cache Monitor.ear\CacheMonitor.war\selectInstance.jsp)


<form name="clearAll" method="get" action="selectInstance.jsp">
	<input type="hidden" name="clearAll" value="true">
	 <input type="submit" value="Clear All" class="buttons">
 if (request.getParameter("clearAll") != null
 	&& request.getParameter("clearAll").equals("true")) {
 	out.println("<script> var msg = 'Clearing All caches....\\n';");
 	 Cache tempCache = null;
 	String cacheName = "";
 	java.util.ListIterator cacheIterator = configuredInstances.listIterator();
 	while (cacheIterator.hasNext()) {
 		cacheName = (String);
 		tempCache = CacheMonitor.getCache(cacheName);
 		out.print("msg = msg + 'Clearing-Cache:::"+cacheName.toString() +"\\n';");

Viet Luu has written 318 articles

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

We are thankful for your never ending support.

Leave a Reply