View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      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      
35      protected HashMap cache;
36  
37      /***
38       * 
39       */
40      public SimpleHashMapCache()
41      {
42          super();
43          cache = new HashMap();        
44      }
45  
46      /***
47       * <p>
48       * get
49       * </p>
50       *
51       * @see org.apache.jetspeed.cache.general.GeneralCache#get(java.lang.String)
52       * @param key
53       * @return
54       */
55      public Object get( String key )
56      {
57         return cache.get(key);
58      }
59  
60      /***
61       * <p>
62       * put
63       * </p>
64       *
65       * @see org.apache.jetspeed.cache.general.GeneralCache#put(java.lang.String, java.lang.Object)
66       * @param key
67       * @param value
68       */
69      public void put( String key, Object value )
70      {
71         cache.put(key, value);
72  
73      }
74  
75      /***
76       * <p>
77       * contains
78       * </p>
79       *
80       * @see org.apache.jetspeed.cache.general.GeneralCache#contains(java.lang.String)
81       * @param key
82       * @return
83       */
84      public boolean contains( String key )
85      {
86          return cache.containsKey(key);
87      }
88  
89      /***
90       * <p>
91       * remove
92       * </p>
93       *
94       * @see org.apache.jetspeed.cache.general.GeneralCache#remove(java.lang.String)
95       * @param key
96       */
97      public Object remove( String key )
98      {
99         return cache.remove(key);
100     }
101 
102 }