1 /***
2 * JFoxSOAF, Service-Oriented Application Framework
3 *
4 * Copyright (C) www.huihoo.org
5 *
6 * Distributable under GNU LGPL
7 *
8 * For more information, please visit: http://www.huihoo.org/jfox/jfoxsoaf
9 */
10
11 package org.huihoo.jfox.soaf.services.cache;
12
13 import java.util.HashMap;
14
15 import org.huihoo.jfox.soaf.exception.CacheServiceException;
16
17 /***
18 * <p>
19 * SimpleCacheService implementation.
20 * </p>
21 *
22 * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
23 * @version $Revision: 1.3 $ $Date: 2004/10/20 08:21:28 $
24 * @version Revision: 1.0
25 */
26
27 public class SimpleCacheServiceImpl implements SimpleCacheService {
28
29 private HashMap cache;
30
31 public SimpleCacheServiceImpl() {
32 cache = new HashMap();
33 }
34
35 /***
36 * @see org.huihoo.jfox.soaf.services.cache.SimpleCacheService#clear()
37 */
38 public void clear() throws CacheServiceException {
39 cache.clear();
40
41 }
42
43 /***
44 * @see org.huihoo.jfox.soaf.services.cache.SimpleCacheService#get(java.lang.Object)
45 */
46 public Object get(Object key) throws CacheServiceException {
47 return cache.get(key);
48 }
49
50 /***
51 * @see org.huihoo.jfox.soaf.services.cache.SimpleCacheService#put(java.lang.Object,
52 * java.lang.Object)
53 */
54 public void put(Object key, Object obj) throws CacheServiceException {
55 cache.put(key, obj);
56 }
57
58 /***
59 * @see org.huihoo.jfox.soaf.services.cache.SimpleCacheService#remove(java.lang.Object)
60 */
61 public void remove(Object key) throws CacheServiceException {
62 cache.remove(key);
63 }
64
65 /***
66 * Return cache size.
67 */
68 public int size() {
69 return cache.size();
70 }
71
72 }