|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| SimpleCacheServiceImpl.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 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 | 5 |
public SimpleCacheServiceImpl() {
|
| 32 | 5 |
cache = new HashMap();
|
| 33 |
} |
|
| 34 |
|
|
| 35 |
/**
|
|
| 36 |
* @see org.huihoo.jfox.soaf.services.cache.SimpleCacheService#clear()
|
|
| 37 |
*/
|
|
| 38 | 1 |
public void clear() throws CacheServiceException { |
| 39 | 1 |
cache.clear(); |
| 40 |
|
|
| 41 |
} |
|
| 42 |
|
|
| 43 |
/**
|
|
| 44 |
* @see org.huihoo.jfox.soaf.services.cache.SimpleCacheService#get(java.lang.Object)
|
|
| 45 |
*/
|
|
| 46 | 2 |
public Object get(Object key) throws CacheServiceException { |
| 47 | 2 |
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 | 3 |
public void put(Object key, Object obj) throws CacheServiceException { |
| 55 | 3 |
cache.put(key, obj); |
| 56 |
} |
|
| 57 |
|
|
| 58 |
/**
|
|
| 59 |
* @see org.huihoo.jfox.soaf.services.cache.SimpleCacheService#remove(java.lang.Object)
|
|
| 60 |
*/
|
|
| 61 | 1 |
public void remove(Object key) throws CacheServiceException { |
| 62 | 1 |
cache.remove(key); |
| 63 |
} |
|
| 64 |
|
|
| 65 |
/**
|
|
| 66 |
* Return cache size.
|
|
| 67 |
*/
|
|
| 68 | 3 |
public int size() { |
| 69 | 3 |
return cache.size();
|
| 70 |
} |
|
| 71 |
|
|
| 72 |
} |
|
||||||||||