Update of /var/cvs/html/mmbase/components/core/cache
In directory james.mmbase.org:/tmp/cvs-serv9424/components/core/cache

Modified Files:
        index.jspx style.css 
Log Message:
cache release strategies


See also: http://cvs.mmbase.org/viewcvs/html/mmbase/components/core/cache


Index: index.jspx
===================================================================
RCS file: /var/cvs/html/mmbase/components/core/cache/index.jspx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- index.jspx  23 Feb 2008 16:52:54 -0000      1.4
+++ index.jspx  21 Mar 2008 15:34:52 -0000      1.5
@@ -5,13 +5,15 @@
     xmlns:fmt="http://java.sun.com/jsp/jstl/fmt";
     class="component ${requestScope.componentClassName}"
     id="${requestScope.componentId}">
-  <jsp:directive.page 
import="java.util.*,org.mmbase.bridge.*,org.mmbase.cache.*" />
+  <jsp:directive.page import="org.mmbase.cache.*" />
   <jsp:output omit-xml-declaration="true" />
   <mm:cloud rank="administrator">
 
 
 <mm:import externid="active" from="request" />
 <mm:import externid="clear"  from="request" />
+<mm:import externid="rs_active" from="request" />
+<mm:import externid="rs_show"   from="request" />
 
 <div
   class="component mm_c ${requestScope.componentClassName}"
@@ -19,12 +21,6 @@
   
   <h3>Cache Monitor</h3>
 
-  <table summary="cache manager" cellspacing="0" cellpadding="3" border="0">
-    <caption>
-      This tools hows the performance of the various MMBase caches. You can 
also (temporary) turn
-      on/off the cache here. For a persistant change you should change 
caches.xml.
-    </caption>
-    
     <!-- activate or deactivate cache -->
     <mm:present referid="active">
       <mm:import externid="cache" />
@@ -33,7 +29,7 @@
           <jsp:scriptlet> 
CacheManager.getCache(cache).setActive(active.equals("on") ? true : false); 
</jsp:scriptlet>
         </mm:write>
       </mm:write>
-      <div class="msg">The cache ${cache} is turned ${active}.</div>
+    <div class="msg">The cache <em>${cache}</em> is turned ${active}.</div>
     </mm:present>
     
     <!-- clear cache -->
@@ -42,11 +38,31 @@
       <mm:write referid="cache" jspvar="cache" vartype="String" write="false">
         <jsp:scriptlet> CacheManager.getCache(cache).clear(); </jsp:scriptlet>
       </mm:write>
-      <div class="msg">The cache ${cache} is turned cleared.</div>
+    <div class="msg">The cache <em>${cache}</em> is cleared.</div>
+  </mm:present>
+
+  <!-- disable or enable release strategies -->
+  <mm:present referid="rs_active">
+    <mm:import externid="cache" />
+    <mm:write referid="rs_active" jspvar="active" vartype="String" 
write="false">
+      <mm:write referid="cache" jspvar="cache" vartype="String" write="false">
+        <jsp:scriptlet> 
+          QueryResultCache qrc = (QueryResultCache) 
CacheManager.getCache(cache);
+          qrc.getReleaseStrategy().setEnabled(active.equals("on") ? true : 
false); 
+        </jsp:scriptlet>
+      </mm:write>
+    </mm:write>
+    <div class="msg">The releasestrategies of cache <em>${cache}</em> are 
turned ${active}.</div>
     </mm:present>
 
+  <table summary="cache manager" cellspacing="0" cellpadding="3" border="0">
+    <caption>
+      This tools hows the performance of the various MMBase caches. You can 
also (temporary) turn
+      on/off the cache here. For a persistant change you should change 
caches.xml.
+    </caption>
+
   <tr>
-    <th colspan="8">Query Caches</th>
+      <th colspan="8"><h4>Query Caches</h4></th>
   </tr><tr>
     <td colspan="8">
       Query caches are used to cache the result of different types of
@@ -67,11 +83,11 @@
           <th class="center">Puts</th>
           <th class="center">Size</th>
           <th class="center">Performance</th>
-          <th class="view">Action</th>
+          <th class="center">Action</th>
         </tr>
       </mm:first>
       <tr>
-        <td> ${qc.name} </td>
+        <td> <strong>${qc.name}</strong> ${qc.description} </td>
         <td class="center"> ${qc.hits + qc.misses} </td> 
         <td class="center"> ${qc.hits} </td>
         <td class="center"> ${qc.misses} </td>
@@ -106,18 +122,82 @@
           </mm:link>
         </td>
       </tr><tr>
-        <td colspan="8">
+        <td colspan="7">
+          Release strategies for this cache:
+          <c:forEach items="${qc.releaseStrategy.list}" var="rs">
+            <mm:link>
+              <mm:param name="rs_show">${qc.name}</mm:param>
+              <mm:param name="rs_name">${rs}</mm:param>
+              <a href="${_}" title="${rs.description}">${rs.name}</a>
+            </mm:link>
+          </c:forEach>
+          <br />
           Events Analyzed: ${qc.releaseStrategy.totalEvaluated}
           Queries preserved: ${qc.releaseStrategy.totalPreserved}
           Queries flushed: ${qc.releaseStrategy.totalEvaluated - 
qc.releaseStrategy.totalPreserved}
+          
+        </td><td class="view">
+          <c:choose>
+            <c:when test="${qc.releaseStrategy.enabled}">
+              <mm:link>
+                <mm:param name="cache">${qc.name}</mm:param>
+                <mm:param name="rs_active">off</mm:param>
+                <a href="${_}">turn off</a>
+              </mm:link>
+            </c:when>
+            <c:otherwise>
+              <mm:link>
+                <mm:param name="cache">${qc.name}</mm:param>
+                <mm:param name="rs_active">on</mm:param>
+                <a href="${_}">turn on</a>
+              </mm:link>
+            </c:otherwise>
+          </c:choose>
+
         </td>
       </tr>
+      <mm:compare referid="rs_show" value="$qc.name">
+        <mm:import externid="rs_name" from="request" />
+        <tr>
+          <td colspan="8">
+            <c:forEach items="${qc.releaseStrategy.list}" var="rs">
+              <c:if test="${rs eq rs_name}">
+                
+                <strong>${rs.name}</strong> ${rs.description}
+                <table summary="specifics of the release strategy ${rs.name}" 
cellspacing="0" cellpadding="3" border="0">
+                  <tr>
+                    <th class="center">active</th>
+                    <th class="center">queries evaluated</th>
+                    <th class="center">queries preserved</th>
+                    <th class="center">evaluation time (millis)</th>
+                    <th class="center">avarage evaluation time (millis)</th>
+                    <th class="center">performance</th>
+                   </tr><tr>
+                     <td class="center"> ${rs.enabled} </td>
+                     <td class="center"> ${rs.totalEvaluated} </td>
+                     <td class="center"> ${rs.totalPreserved} </td>
+                     <td class="center"> ${rs.totalEvaluationTimeMillis} </td>
+                     <td class="center"> 
+                       <fmt:formatNumber value="${rs.totalEvaluationTimeMillis 
/ rs.totalEvaluated}" maxFractionDigits="2" />
+                     </td>
+                     <td class="center"> 
+                       <fmt:formatNumber value="${rs.totalEvaluated / 
rs.totalPreserved}" maxFractionDigits="2" type="percent" />
+                     </td>
+                  </tr>
+                </table>
+              </c:if>
+            </c:forEach>
+          </td>
+        </tr>
+      </mm:compare>
     </mm:listfunction>
   </mm:functioncontainer>
 
   <!-- other caches -->
   <tr>
-    <th colspan="8">Other Caches</th>
+    <td colspan="8"><br /> </td>
+  </tr><tr>
+    <th colspan="8"><h4>Other Caches</h4></th>
   </tr><tr>
     <td colspan="8">
       More general MMBase caches.
@@ -134,11 +214,11 @@
           <th class="center">Puts</th>
           <th class="center">Size</th>
           <th class="center">Performance</th>
-          <th class="view">Action</th>
+          <th class="center">Action</th>
         </tr>
       </mm:first>
       <tr>
-        <td> ${c.name} </td>
+        <td> <strong>${c.name}</strong> ${c.description} </td>
         <td class="center"> ${c.hits + c.misses} </td> 
         <td class="center"> ${c.hits} </td>
         <td class="center"> ${c.misses} </td>


Index: style.css
===================================================================
RCS file: /var/cvs/html/mmbase/components/core/cache/style.css,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- style.css   23 Feb 2008 16:48:57 -0000      1.1
+++ style.css   21 Mar 2008 15:34:52 -0000      1.2
@@ -1,17 +1,6 @@
-.label
+h4
 {
-       background-color: #cccccc;
-       width: 50%;
-       float: left;
+       font-size: 1.1em;
+       margin: 0;
 }
-
-.data { float: left; }
-
-.row
-{
-       border-bottom: 1px solid black;
-       overflow: auto;
-}
-
-a:visited { color: blue; }
-hr { color: #333333; }
+strong { display: block; }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to