1 /***
2 * Copyright 2003-2010 Terracotta, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.ehcache.statistics.sampled;
17
18 /***
19 * Interface for <strong>sampled</strong> usage statistics of a Cache
20 *
21 * <p />
22 *
23 * @author <a href="mailto:asanoujam@terracottatech.com">Abhishek Sanoujam</a>
24 * @since 1.7
25 */
26 public interface SampledCacheStatistics {
27
28 /***
29 * Get most recent value for cache hit
30 *
31 * @return Most recent sample for cache hit count
32 */
33 long getCacheHitMostRecentSample();
34
35 /***
36 * Get most recent value for in-memory cache hit
37 *
38 * @return Most recent sample for cache hit count in memory
39 */
40 long getCacheHitInMemoryMostRecentSample();
41
42 /***
43 * Get most recent value for off-heap cache hit
44 *
45 * @return Most recent sample for cache hit count in off-heap
46 */
47 long getCacheHitOffHeapMostRecentSample();
48
49 /***
50 * Get most recent value for on-disk cache hit
51 *
52 * @return Most recent sample for cache hit count on disk
53 */
54 long getCacheHitOnDiskMostRecentSample();
55
56 /***
57 * Get most recent value for cache miss
58 *
59 * @return Most recent sample for cache miss count
60 */
61 long getCacheMissMostRecentSample();
62
63 /***
64 * Get most recent value for in-memory cache miss
65 *
66 * @return Most recent sample for cache miss count in memory
67 */
68 long getCacheMissInMemoryMostRecentSample();
69
70 /***
71 * Get most recent value for off-heap cache miss
72 *
73 * @return Most recent sample for cache miss count in off-heap
74 */
75 long getCacheMissOffHeapMostRecentSample();
76
77 /***
78 * Get most recent value for on-disk cache miss
79 *
80 * @return Most recent sample for cache miss count on disk
81 */
82 long getCacheMissOnDiskMostRecentSample();
83
84 /***
85 * Get most recent value for cache miss as result of the element getting
86 * expired
87 *
88 * @return Most recent sample for cache miss count and the reason for miss
89 * being the element got expired
90 */
91 long getCacheMissExpiredMostRecentSample();
92
93 /***
94 * Get most recent value for cache miss as result of the element not found
95 * in cache
96 *
97 * @return Most recent sample for cache miss not found count
98 */
99 long getCacheMissNotFoundMostRecentSample();
100
101 /***
102 * Get most recent value element evicted from cache
103 *
104 * @return Most recent sample for element evicted count
105 */
106 long getCacheElementEvictedMostRecentSample();
107
108 /***
109 * Get most recent value element removed from cache
110 *
111 * @return Most recent sample for element removed count
112 */
113 long getCacheElementRemovedMostRecentSample();
114
115 /***
116 * Get most recent value element expired from cache
117 *
118 * @return Most recent value for element expired count
119 */
120 long getCacheElementExpiredMostRecentSample();
121
122 /***
123 * Get most recent value element puts in the cache
124 *
125 * @return Most recent sample for number of element puts
126 */
127 long getCacheElementPutMostRecentSample();
128
129 /***
130 * Get most recent value element updates , i.e. put() on elements with
131 * already existing keys in the cache
132 *
133 * @return Most recent sampled value for element update count
134 */
135 long getCacheElementUpdatedMostRecentSample();
136
137 /***
138 * Get most recent value for average time taken for get() operation in the
139 * cache
140 *
141 * @return Most recent sample of average get time taken for a get operation
142 */
143 long getAverageGetTimeMostRecentSample();
144
145 /***
146 * Get value for statisticsAccuracy
147 *
148 * @return one of Statistics#STATISTICS_ACCURACY_BEST_EFFORT,
149 * Statistics#STATISTICS_ACCURACY_GUARANTEED,
150 * Statistics#STATISTICS_ACCURACY_NONE
151 */
152 int getStatisticsAccuracy();
153
154 /***
155 * Get Description for statisticsAccuracy
156 */
157 String getStatisticsAccuracyDescription();
158
159 /***
160 * Returns true if statistics collection is enabled for cache, otherwise
161 * false
162 *
163 * @return true if sampled statistics is enabled, false otherwise
164 */
165 boolean isSampledStatisticsEnabled();
166
167 /***
168 * Method used to dispose this statistics
169 */
170 void dispose();
171
172 /***
173 * Clears sampled statistics for this cache
174 */
175 void clearStatistics();
176
177 /***
178 * Get the average search execution time for searches finishing within the last sample period
179 */
180 long getAverageSearchTime();
181
182 /***
183 * Get the number of searches that have finished execution in the last second
184 */
185 long getSearchesPerSecond();
186
187 /***
188 * Get most recent value of XA commits
189 */
190 long getCacheXaCommitsMostRecentSample();
191
192 /***
193 * Get most recent value of XA rollbacks
194 */
195 long getCacheXaRollbacksMostRecentSample();
196 }