Author: mircea.markus
Date: 2007-12-07 06:22:27 -0500 (Fri, 07 Dec 2007)
New Revision: 4805
Added:
cache-bench-fwk/trunk/cache-products/terracotta-2.4.8/
Modified:
cache-bench-fwk/trunk/cache-products/terracotta-2.4.8/src/org/cachebench/cachewrappers/TerracottaWrapper.java
Log:
Copied: cache-bench-fwk/trunk/cache-products/terracotta-2.4.8 (from rev 4801,
cache-bench-fwk/trunk/cache-products/terracotta-2.3.0)
Modified:
cache-bench-fwk/trunk/cache-products/terracotta-2.4.8/src/org/cachebench/cachewrappers/TerracottaWrapper.java
===================================================================
---
cache-bench-fwk/trunk/cache-products/terracotta-2.3.0/src/org/cachebench/cachewrappers/TerracottaWrapper.java 2007-12-07
09:27:00 UTC (rev 4801)
+++
cache-bench-fwk/trunk/cache-products/terracotta-2.4.8/src/org/cachebench/cachewrappers/TerracottaWrapper.java 2007-12-07
11:22:27 UTC (rev 4805)
@@ -4,6 +4,7 @@
import java.util.Properties;
import java.util.Map;
+import java.util.HashMap;
/**
* Cache wrapper for Terracotta 2.3.0
@@ -16,41 +17,53 @@
{
// Since terracotta
private Map cache;
+
public void init(Properties parameters) throws Exception
{
- //To change body of implemented methods use File | Settings | File Templates.
}
public void setUp() throws Exception
{
+ cache = new HashMap();
}
public void tearDown() throws Exception
{
+ cache.clear();
+ cache = null;
}
public void put(Object key, Object value) throws Exception
{
- //To change body of implemented methods use File | Settings | File Templates.
+ synchronized(cache)
+ {
+ cache.put(key, value);
+ }
}
public Object get(Object key) throws Exception
{
- return null; //To change body of implemented methods use File | Settings | File
Templates.
+ synchronized(cache)
+ {
+ return cache.get(key);
+ }
}
public void empty() throws Exception
{
- //To change body of implemented methods use File | Settings | File Templates.
+ synchronized(cache)
+ {
+ cache.clear();
+ }
}
public int getNumMembers()
{
- return 0; //To change body of implemented methods use File | Settings | File
Templates.
+ return -1;
}
public String getInfo()
{
- return null; //To change body of implemented methods use File | Settings | File
Templates.
+ return "There are " + cache.size() + " objects in cache";
}
}
Show replies by date