1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.apache.jetspeed.cache.general;
24
25 /***
26 * <p>
27 * InvocationCountingCache
28 * </p>
29 * <p>
30 *
31 * </p>
32 * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
33 * @version $Id: InvocationCountingCache.java 516881 2007-03-11 10:34:21Z ate $
34 *
35 */
36 public class InvocationCountingCache extends SimpleHashMapCache
37 {
38 int getCount, putCount, removeCount, successGetCount, containsCount;
39
40
41 public Object get( String key )
42 {
43 getCount++;
44
45 Object value = super.get(key);
46 if(value != null)
47 {
48 successGetCount++;
49 }
50
51 return value;
52 }
53
54 public void put( String key, Object value )
55 {
56 putCount++;
57 super.put(key, value);
58 }
59
60 public Object remove( String key )
61 {
62 removeCount++;
63 return super.remove(key);
64 }
65
66 public boolean contains( String key )
67 {
68 containsCount++;
69 return super.contains(key);
70 }
71 }