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 private static int _counter = 0;
28
29 public final String strVal;
30 public final int intVal = _counter++;
31
32 private CacheStat() {
33 strVal= null;
34 }
35
36 private CacheStat(String name) {
37 strVal= name;
38 }
39
40 public String toString() {
41 return strVal;
42 }
43
44 public int getIntValue() {
45 return intVal;
46 }
47
48 public String getStrValue() {
49 return strVal;
50 }
51
52 public boolean equals(CacheStat stat) {
53 return (null != stat && stat.strVal.equals(strVal));
54 }
55
56 public int hashCode() {
57 return intVal;
58 }
59
60 public static final CacheStat NUM_RETRIEVE_REQUESTED = new CacheStat("number of retrievals requested");
61 public static final CacheStat NUM_RETRIEVE_FOUND = new CacheStat("number of retrievals found");
62 public static final CacheStat NUM_RETRIEVE_NOT_FOUND = new CacheStat("number of retrievals not found");
63 public static final CacheStat NUM_STORE_REQUESTED = new CacheStat("number of stores requested");
64 public static final CacheStat NUM_STORE_STORED = new CacheStat("number of objects stored");
65 public static final CacheStat NUM_STORE_NOT_STORED = new CacheStat("number of objects not stored");
66 public static final CacheStat NUM_CLEARED = new CacheStat("number of objects cleared");
67 public static final CacheStat CUR_CAPACITY = new CacheStat("current capacity");
68 }