1 package org.apache.jcs.engine.stats;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.jcs.engine.stats.behavior.ICacheStats;
23 import org.apache.jcs.engine.stats.behavior.IStatElement;
24 import org.apache.jcs.engine.stats.behavior.IStats;
25
26 /***
27 * This class stores cache historical and statistics data for a region.
28 *
29 * Only the composite cache knows what the hit count across all auxiliaries is.
30 *
31 * @author aaronsm
32 *
33 */
34 public class CacheStats
35 extends Stats
36 implements ICacheStats
37 {
38 private static final long serialVersionUID = 529914708798168590L;
39
40 private String regionName = null;
41
42 private IStats[] auxStats = null;
43
44 private IStatElement[] stats = null;
45
46
47
48
49
50
51 public String getRegionName()
52 {
53 return regionName;
54 }
55
56
57
58
59
60
61 public void setRegionName( String name )
62 {
63 regionName = name;
64 }
65
66
67
68
69
70
71 public IStats[] getAuxiliaryCacheStats()
72 {
73 return auxStats;
74 }
75
76
77
78
79
80
81 public void setAuxiliaryCacheStats( IStats[] stats )
82 {
83 auxStats = stats;
84 }
85
86 /***
87 * This returns data about the auxiliaries, such as hit count. Only the
88 * composite cache knows what the hit count across all auxiliaries is.
89 * @return IStatElement[]
90 */
91 public IStatElement[] getStatElements()
92 {
93 return stats;
94 }
95
96
97
98
99
100
101 public void setStatElements( IStatElement[] stats )
102 {
103 this.stats = stats;
104 }
105
106
107
108
109
110
111 public String toString()
112 {
113 StringBuffer buf = new StringBuffer();
114
115 buf.append( "Region Name = " + regionName );
116
117 if ( stats != null )
118 {
119 for ( int i = 0; i < stats.length; i++ )
120 {
121 buf.append( "\n" );
122 buf.append( stats[i] );
123 }
124 }
125
126 if ( auxStats != null )
127 {
128 for ( int i = 0; i < auxStats.length; i++ )
129 {
130 buf.append( "\n" );
131 buf.append( "---------------------------" );
132 buf.append( auxStats[i] );
133 }
134 }
135
136 return buf.toString();
137 }
138 }