1 package org.apache.commons.jcs3.admin;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.beans.ConstructorProperties;
23
24
25
26 /**
27 * Stores info on a cache region for the template
28 */
29 public class CacheRegionInfo
30 {
31 /** The name of the cache region */
32 private final String cacheName;
33
34 /** The size of the cache region */
35 private final int cacheSize;
36
37 /** The status of the cache region */
38 private final String cacheStatus;
39
40 /** The statistics of the cache region */
41 private final String cacheStatistics;
42
43 /** The number of memory hits in the cache region */
44 private final long hitCountRam;
45
46 /** The number of auxiliary hits in the cache region */
47 private final long hitCountAux;
48
49 /** The number of misses in the cache region because the items were not found */
50 private final long missCountNotFound;
51
52 /** The number of misses in the cache region because the items were expired */
53 private final long missCountExpired;
54
55 /** The number of bytes counted so far, will be a total of all items */
56 private final long byteCount;
57
58 /**
59 * Parameterized constructor
60 *
61 * @param cacheName The name of the cache region
62 * @param cacheSize The size of the cache region
63 * @param cacheStatus The status of the cache region
64 * @param cacheStatistics The statistics of the cache region
65 * @param hitCountRam The number of memory hits in the cache region
66 * @param hitCountAux The number of auxiliary hits in the cache region
67 * @param missCountNotFound The number of misses in the cache region because the items were not found
68 * @param missCountExpired The number of misses in the cache region because the items were expired
69 * @param byteCount The number of bytes counted so far, will be a total of all items
70 */
71 @ConstructorProperties({"cacheName", "cacheSize", "cacheStatus", "cacheStatistics",
72 "hitCountRam", "hitCountAux", "missCountNotFound", "missCountExpired", "byteCount"})
73 public CacheRegionInfo(final String cacheName, final int cacheSize, final String cacheStatus,
74 final String cacheStatistics, final long hitCountRam, final long hitCountAux,
75 final long missCountNotFound, final long missCountExpired, final long byteCount)
76 {
77 this.cacheName = cacheName;
78 this.cacheSize = cacheSize;
79 this.cacheStatus = cacheStatus;
80 this.cacheStatistics = cacheStatistics;
81 this.hitCountRam = hitCountRam;
82 this.hitCountAux = hitCountAux;
83 this.missCountNotFound = missCountNotFound;
84 this.missCountExpired = missCountExpired;
85 this.byteCount = byteCount;
86 }
87
88 /**
89 * @return the cacheName
90 */
91 public String getCacheName()
92 {
93 return this.cacheName;
94 }
95
96 /**
97 * @return the cacheSize
98 */
99 public int getCacheSize()
100 {
101 return this.cacheSize;
102 }
103
104 /**
105 * @return a status string
106 */
107 public String getCacheStatus()
108 {
109 return this.cacheStatus;
110 }
111
112 /**
113 * Return the statistics for the region.
114 * <p>
115 * @return String
116 */
117 public String getCacheStatistics()
118 {
119 return this.cacheStatistics;
120 }
121
122 /**
123 * @return the hitCountRam
124 */
125 public long getHitCountRam()
126 {
127 return hitCountRam;
128 }
129
130 /**
131 * @return the hitCountAux
132 */
133 public long getHitCountAux()
134 {
135 return hitCountAux;
136 }
137
138 /**
139 * @return the missCountNotFound
140 */
141 public long getMissCountNotFound()
142 {
143 return missCountNotFound;
144 }
145
146 /**
147 * @return the missCountExpired
148 */
149 public long getMissCountExpired()
150 {
151 return missCountExpired;
152 }
153
154 /**
155 * @return total byte count
156 */
157 public long getByteCount()
158 {
159 return this.byteCount;
160 }
161
162 /**
163 * @return string info on the region
164 */
165 @Override
166 public String toString()
167 {
168 final StringBuilder buf = new StringBuilder();
169 buf.append( "\nCacheRegionInfo " );
170 if ( cacheName != null )
171 {
172 buf.append( "\n CacheName [" + cacheName + "]" );
173 buf.append( "\n Status [" + cacheStatus + "]" );
174 }
175 buf.append( "\n ByteCount [" + getByteCount() + "]" );
176
177 return buf.toString();
178 }
179 }