Clear all websphere portal dynacache (distributedmap) with one click

http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Clear_all_websphere_portal_dyna_caches_lprdistributedmaprpr_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">
 </form>
<%
 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)cacheIterator.next();
 		tempCache = CacheMonitor.getCache(cacheName);
 		out.print("msg = msg + 'Clearing-Cache:::"+cacheName.toString() +"\\n';");
 		 System.out.println("Clearing-Cache:::"+cacheName.toString());
 		 tempCache.clear();
 	}
 	 out.println("alert(msg);</script>");
 }
%>
<br/>
  •  
  •  
  •  
  •  

Viet Luu has written 206 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