Skip to content

Commit 60f296a

Browse files
author
James Taylor
committed
Added more hit/miss tracking to CompositeCache, and made those counts available
via the admin servlet (perhaps JMX someday). Also, removed DCL from dispose, and tried to comment what is going on there (still not entirely sure =) PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/jcs/trunk@223999 13f79535-47bb-0310-9956-ffa450edef68
1 parent ad75176 commit 60f296a

File tree

3 files changed

+186
-114
lines changed

3 files changed

+186
-114
lines changed

src/java/org/apache/jcs/admin/servlet/JCSAdminServlet.java

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,8 @@ private LinkedList buildCacheInfo() throws Exception
176176

177177
regionInfo = new CacheRegionInfo();
178178

179-
regionInfo.name = cache.getCacheName();
180-
regionInfo.itemCount = cache.getSize();
179+
regionInfo.cache = cache;
181180
regionInfo.byteCount = getByteCount( cache );
182-
regionInfo.status = statusAsString( cache );
183181

184182
cacheInfo.add( regionInfo );
185183
}
@@ -210,16 +208,6 @@ public int getByteCount( CompositeCache cache )
210208
return counter.getCount() - 4;
211209
}
212210

213-
private String statusAsString( ICache cache )
214-
{
215-
int status = cache.getStatus();
216-
217-
return ( status == CacheConstants.STATUS_ALIVE ? "ALIVE"
218-
: status == CacheConstants.STATUS_DISPOSED ? "DISPOSED"
219-
: status == CacheConstants.STATUS_ERROR ? "ERROR"
220-
: "UNKNOWN" );
221-
}
222-
223211
private void clearAllRegions() throws IOException
224212
{
225213
String[] names = cacheHub.getCacheNames();
@@ -243,19 +231,12 @@ private void removeItem( String cacheName, String key ) throws IOException
243231
/** Stores info on a cache region for the template */
244232
public class CacheRegionInfo
245233
{
246-
String name = null;
247-
long itemCount = 0;
234+
CompositeCache cache = null;
248235
long byteCount = 0;
249-
String status = null;
250236

251-
public String getName()
237+
public CompositeCache getCache()
252238
{
253-
return name;
254-
}
255-
256-
public long getItemCount()
257-
{
258-
return itemCount;
239+
return cache;
259240
}
260241

261242
public long getByteCount()
@@ -265,7 +246,12 @@ public long getByteCount()
265246

266247
public String getStatus()
267248
{
268-
return status;
249+
int status = cache.getStatus();
250+
251+
return ( status == CacheConstants.STATUS_ALIVE ? "ALIVE"
252+
: status == CacheConstants.STATUS_DISPOSED ? "DISPOSED"
253+
: status == CacheConstants.STATUS_ERROR ? "ERROR"
254+
: "UNKNOWN" );
269255
}
270256
}
271257

src/java/org/apache/jcs/admin/servlet/JCSAdminServletDefault.vm

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,22 @@ which empties the entire cache.</p>
1818
<th> Items </th>
1919
<th> Bytes </th>
2020
<th> Status </th>
21+
<th> Memory Hits </th>
22+
<th> Aux Hits </th>
23+
<th> Not Found Misses </th>
24+
<th> Expired Misses </th>
2125
</tr>
2226

2327
#foreach ( $record in $cacheInfoRecords )
2428
<tr>
25-
<td> $record.Name </td>
26-
<td> $record.ItemCount </td>
27-
<td> $record.ByteCount </td>
28-
<td> $record.Status </td>
29+
<td> $record.cache.cacheName </td>
30+
<td> $record.cache.size </td>
31+
<td> $record.byteCount </td>
32+
<td> $record.status </td>
33+
<td> $record.cache.hitCountRam </td>
34+
<td> $record.cache.hitCountAux </td>
35+
<td> $record.cache.missCountNotFound </td>
36+
<td> $record.cache.missCountExpired </td>
2937
<td>
3038
<a href="?action=detail&cacheName=${record.Name}"> Detail </a>
3139
| <a href="?action=clearRegion&cacheName=${record.Name}"> Remove all </a>

0 commit comments

Comments
 (0)