1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.apache.commons.cache; |
17 | |
|
18 | |
import java.io.Serializable; |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
public final class CacheStat implements Serializable { |
27 | 0 | private static int _counter = 0; |
28 | |
|
29 | |
public final String strVal; |
30 | 0 | public final int intVal = _counter++; |
31 | |
|
32 | 0 | private CacheStat() { |
33 | 0 | strVal= null; |
34 | 0 | } |
35 | |
|
36 | 0 | private CacheStat(String name) { |
37 | 0 | strVal= name; |
38 | 0 | } |
39 | |
|
40 | |
public String toString() { |
41 | 0 | return strVal; |
42 | |
} |
43 | |
|
44 | |
public int getIntValue() { |
45 | 0 | return intVal; |
46 | |
} |
47 | |
|
48 | |
public String getStrValue() { |
49 | 0 | return strVal; |
50 | |
} |
51 | |
|
52 | |
public boolean equals(CacheStat stat) { |
53 | 0 | return (null != stat && stat.strVal.equals(strVal)); |
54 | |
} |
55 | |
|
56 | |
public int hashCode() { |
57 | 0 | return intVal; |
58 | |
} |
59 | |
|
60 | 0 | public static final CacheStat NUM_RETRIEVE_REQUESTED = new CacheStat("number of retrievals requested"); |
61 | 0 | public static final CacheStat NUM_RETRIEVE_FOUND = new CacheStat("number of retrievals found"); |
62 | 0 | public static final CacheStat NUM_RETRIEVE_NOT_FOUND = new CacheStat("number of retrievals not found"); |
63 | 0 | public static final CacheStat NUM_STORE_REQUESTED = new CacheStat("number of stores requested"); |
64 | 0 | public static final CacheStat NUM_STORE_STORED = new CacheStat("number of objects stored"); |
65 | 0 | public static final CacheStat NUM_STORE_NOT_STORED = new CacheStat("number of objects not stored"); |
66 | 0 | public static final CacheStat NUM_CLEARED = new CacheStat("number of objects cleared"); |
67 | 0 | public static final CacheStat CUR_CAPACITY = new CacheStat("current capacity"); |
68 | |
} |