~ubuntu-branches/ubuntu/oneiric/ehcache/oneiric

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/**
 *  Copyright 2003-2010 Terracotta, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package net.sf.ehcache.management.sampled;

import net.sf.ehcache.statistics.LiveCacheStatistics;
import net.sf.ehcache.statistics.sampled.SampledCacheStatistics;

/**
 * An MBean for Cache exposing cache statistics.
 * Extends from both {@link LiveCacheStatistics} and {@link SampledCacheStatistics}
 * 
 * <p />
 * 
 * @author <a href="mailto:asanoujam@terracottatech.com">Abhishek Sanoujam</a>
 * @since 1.7
 */
public interface SampledCacheMBean extends LiveCacheStatistics, SampledCacheStatistics {
    /**
     * CACHE_ENABLED
     */
    public static final String CACHE_ENABLED = "CacheEnabled";
    
    /**
     * CACHE_CHANGED
     */
    public static final String CACHE_CHANGED = "CacheChanged";
    
    /**
     * CACHE_FLUSHED
     */
    public static final String CACHE_FLUSHED = "CacheFlushed";
    
    /**
     * CACHE_CLEARED
     */
    public static final String CACHE_CLEARED = "CacheCleared";
    
    /**
     * CACHE_STATISTICS_ENABLED
     */
    public static final String CACHE_STATISTICS_ENABLED = "CacheStatisticsEnabled";
    
    /**
     * CACHE_STATISTICS_RESET
     */
    public static final String CACHE_STATISTICS_RESET = "CacheStatisticsReset";

    /**
     * Is the cache enabled?
     */
    boolean isEnabled();
    
    /**
     * Enabled/disable cache coherence mode for this node.
     */
    void setNodeCoherent(boolean coherent);
    
    /**
     * Is the cache coherent cluster-wide?
     */
    boolean isClusterCoherent();

    /**
     * Is the cache coherent locally?
     */
    boolean isNodeCoherent();
    
    /**
     * Enabled/disable the cache.
     */
    void setEnabled(boolean enabled);
    
    /**
     * Removes all cached items.
     */
    void removeAll();

    /**
     * Flushes all cache items from memory to the disk store, and from the
     * DiskStore to disk.
     */
    void flush();

    /**
     * Gets the status attribute of the Cache.
     * 
     * @return The status value from the Status enum class
     */
    String getStatus();

    /**
     * Is the cache configured with Terracotta clustering?
     * 
     * @return true if clustered with terracotta
     */
    public boolean isTerracottaClustered();

    /**
     * Clear both sampled and cumulative statistics
     */
    public void clearStatistics();

    /**
     * Enables statistics collection
     */
    public void enableStatistics();

    /**
     * Disables statistics collection. Also disables sampled statistics if it is
     * enabled.
     */
    public void disableStatistics();

    /**
     * Controls the statistics. Also controls sampled statistics if it is
     * enabled.
     */
    public void setStatisticsEnabled(boolean statsEnabled);
    
    /**
     * Enables statistics collection. As it requires that normal statistics
     * collection to be enabled, it enables it if its not already
     */
    public void enableSampledStatistics();

    /**
     * Disables statistics collection
     */
    public void disableSampledStatistics();

    /**
     * Configuration property accessor
     * 
     * @return Max elements in memory config setting value
     */
    public int getConfigMaxElementsInMemory();

    /**
     * setConfigMaxElementsInMemory
     * @param maxElements
     */
    public void setConfigMaxElementsInMemory(int maxElements);
    
    /**
     * Configuration property accessor
     * 
     * @return Max elements on disk config setting value
     */
    public int getConfigMaxElementsOnDisk();

    /**
     * setConfigMaxElementsOnDisk
     * @param maxElements
     */
    public void setConfigMaxElementsOnDisk(int maxElements);
    
    /**
     * Configuration property accessor
     * 
     * @return a String representation of the policy
     */
    public String getConfigMemoryStoreEvictionPolicy();

    /**
     * setConfigMemoryStoreEvictionPolicy
     * @param evictionPolicy
     */
    public void setConfigMemoryStoreEvictionPolicy(String evictionPolicy);

    /**
     * Configuration property accessor
     * 
     * @return true if set to eternal in config
     */
    public boolean isConfigEternal();

    /**
     * setConfigEternal
     * @param eternal
     */
    public void setConfigEternal(boolean eternal);
    
    /**
     * Configuration property accessor
     * 
     * @return TTI in config
     */
    public long getConfigTimeToIdleSeconds();

    /**
     * setConfigTimeToIdleSeconds
     * @param tti
     */
    public void setConfigTimeToIdleSeconds(long tti);
    
    /**
     * Configuration property accessor
     * 
     * @return TTL in config
     */
    public long getConfigTimeToLiveSeconds();

    /**
     * setConfigTimeToLiveSeconds
     * @param ttl
     */
    public void setConfigTimeToLiveSeconds(long ttl);
    
    /**
     * Configuration property accessor
     * 
     * @return true if overflow to disk specified in config
     */
    public boolean isConfigOverflowToDisk();

    /**
     * setConfigOverflowToDisk
     * @param overflowToDisk
     */
    public void setConfigOverflowToDisk(boolean overflowToDisk);
    
    /**
     * Configuration property accessor
     * 
     * @return true if configured with disk persistence
     */
    public boolean isConfigDiskPersistent();

    /**
     * setConfigDiskPersistent
     * @param diskPersistent
     */
    public void setConfigDiskPersistent(boolean diskPersistent);
    
    /**
     * Configuration property accessor
     * 
     * @return Value for disk expiry thread interval in seconds specified in config
     */
    public long getConfigDiskExpiryThreadIntervalSeconds();

    /**
     * setConfigDiskExpiryThreadIntervalSeconds
     * @param seconds
     */
    public void setConfigDiskExpiryThreadIntervalSeconds(long seconds);
 
    /**
     * Configuration property accessor
     * 
     * @return true if logging is enabled on the cache
     */
    public boolean isConfigLoggingEnabled();

    /**
     * setConfigLoggingEnabled
     * @param enabled
     */
    public void setConfigLoggingEnabled(boolean enabled);
}