01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jetspeed.cache.general;
18:
19: import java.util.HashMap;
20:
21: /**
22: * <p>
23: * SimpleHashMapCache
24: * </p>
25: * <p>
26: *
27: * </p>
28: * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
29: * @version $Id: SimpleHashMapCache.java 516448 2007-03-09 16:25:47Z ate $
30: *
31: */
32: public class SimpleHashMapCache implements GeneralCache {
33:
34: protected HashMap cache;
35:
36: /**
37: *
38: */
39: public SimpleHashMapCache() {
40: super ();
41: cache = new HashMap();
42: }
43:
44: /**
45: * <p>
46: * get
47: * </p>
48: *
49: * @see org.apache.jetspeed.cache.general.GeneralCache#get(java.lang.String)
50: * @param key
51: * @return
52: */
53: public Object get(String key) {
54: return cache.get(key);
55: }
56:
57: /**
58: * <p>
59: * put
60: * </p>
61: *
62: * @see org.apache.jetspeed.cache.general.GeneralCache#put(java.lang.String, java.lang.Object)
63: * @param key
64: * @param value
65: */
66: public void put(String key, Object value) {
67: cache.put(key, value);
68:
69: }
70:
71: /**
72: * <p>
73: * contains
74: * </p>
75: *
76: * @see org.apache.jetspeed.cache.general.GeneralCache#contains(java.lang.String)
77: * @param key
78: * @return
79: */
80: public boolean contains(String key) {
81: return cache.containsKey(key);
82: }
83:
84: /**
85: * <p>
86: * remove
87: * </p>
88: *
89: * @see org.apache.jetspeed.cache.general.GeneralCache#remove(java.lang.String)
90: * @param key
91: */
92: public Object remove(String key) {
93: return cache.remove(key);
94: }
95:
96: }
|