Index: modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/soap/exceptions/ResultSetException.java
===================================================================
--- modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/soap/exceptions/ResultSetException.java	(nonexistent)
+++ modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/soap/exceptions/ResultSetException.java	(revision 36363)
@@ -0,0 +1,25 @@
+package eu.dnetlib.rmi.soap.exceptions;
+
+import javax.xml.ws.WebFault;
+
+@WebFault(name = "ResultSetException", targetNamespace = "http://services.dnetlib.eu/")
+public class ResultSetException extends DnetSoapException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -165056337086508889L;
+
+	public ResultSetException(final String string) {
+		super(string);
+	}
+
+	public ResultSetException(final String string, final Throwable exception) {
+		super(string, exception);
+	}
+
+	public ResultSetException(final Throwable exception) {
+		super(exception);
+	}
+
+}
Index: modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/soap/ResultSetService.java
===================================================================
--- modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/soap/ResultSetService.java	(revision 36362)
+++ modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/soap/ResultSetService.java	(revision 36363)
@@ -1,8 +1,13 @@
 package eu.dnetlib.rmi.soap;
 
+import javax.jws.WebParam;
 import javax.jws.WebService;
 
+import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse;
+import eu.dnetlib.rmi.soap.exceptions.ResultSetException;
+
 @WebService(targetNamespace = "http://services.dnetlib.eu/")
 public interface ResultSetService extends BaseService {
 
+	ResultSetResponse getNextResults(@WebParam(name = "rsId") String rsId, @WebParam(name = "n") int n) throws ResultSetException;
 }
Index: modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/rest/ResultSetService.java
===================================================================
--- modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/rest/ResultSetService.java	(revision 36362)
+++ modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/rest/ResultSetService.java	(revision 36363)
@@ -1,8 +1,9 @@
 package eu.dnetlib.rmi.rest;
 
 import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse;
+import eu.dnetlib.rmi.soap.exceptions.ResultSetException;
 
 public interface ResultSetService {
 
-	ResultSetResponse getNextResults(String rsId, int n);
+	ResultSetResponse getNextResults(String rsId, int n) throws ResultSetException;
 }
Index: modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetRegistry.java
===================================================================
--- modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetRegistry.java	(revision 36362)
+++ modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetRegistry.java	(revision 36363)
@@ -1,23 +1,64 @@
 package eu.dnetlib.enabling.resultSetManager;
 
-import java.util.Map;
 import java.util.UUID;
 
-import com.google.common.collect.Maps;
+import javax.annotation.PostConstruct;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.annotation.Required;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
+
+import eu.dnetlib.rmi.soap.exceptions.ResultSetException;
+
 public class ResultSetRegistry {
 
-	private Map<String, ResultSetIterator<?>> maps = Maps.newHashMap();
+	private static final Log log = LogFactory.getLog(ResultSetRegistry.class);
 
-	public ResultSetIterator<?> findIterator(final String rsId) {
-		return maps.get(rsId);
+	private CacheBuilder<String, ResultSetIterator<?>> cacheBuilder;
+	private Cache<String, ResultSetIterator<?>> cache;
+
+	@PostConstruct
+	public void initCache() {
+		cache = cacheBuilder.removalListener(new RemovalListener<String, ResultSetIterator<?>>() {
+
+			@Override
+			public void onRemoval(final RemovalNotification<String, ResultSetIterator<?>> notification) {
+				log.info("Deleting old resultset: " + notification.getKey() + " - finished: " + notification.getValue().isFinished());
+			}
+		}).build();
 	}
 
+	public ResultSetIterator<?> findIterator(final String rsId) throws ResultSetException {
+
+		final ResultSetIterator<?> iter = cache.getIfPresent(rsId);
+		if (iter != null) {
+			return iter;
+		} else {
+			log.error("Resultset not found, id = " + rsId);
+			throw new ResultSetException("ResultSet not found, id = " + rsId);
+		}
+	}
+
 	public String registerIterator(final ResultSetIterator<?> iter) {
 		final String rsId = "rs-" + UUID.randomUUID();
 
-		maps.put(rsId, iter);
+		cache.put(rsId, iter);
 
 		return rsId;
 	}
+
+	public CacheBuilder<String, ResultSetIterator<?>> getCacheBuilder() {
+		return cacheBuilder;
+	}
+
+	@Required
+	public void setCacheBuilder(final CacheBuilder<String, ResultSetIterator<?>> cacheBuilder) {
+		this.cacheBuilder = cacheBuilder;
+	}
+
 }
Index: modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetServiceCore.java
===================================================================
--- modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetServiceCore.java	(nonexistent)
+++ modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetServiceCore.java	(revision 36363)
@@ -0,0 +1,44 @@
+package eu.dnetlib.enabling.resultSetManager;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Required;
+import org.springframework.web.bind.annotation.PathVariable;
+
+import com.google.common.collect.Lists;
+import com.google.gson.Gson;
+
+import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse;
+import eu.dnetlib.rmi.soap.exceptions.ResultSetException;
+
+public class ResultSetServiceCore {
+
+	private ResultSetRegistry registry;
+
+	public ResultSetResponse getNextResults(@PathVariable final String rsId, @PathVariable final int n) throws ResultSetException {
+		final ResultSetIterator<?> iter = registry.findIterator(rsId);
+
+		final int from = iter.position();
+		final Gson gson = new Gson();
+
+		final List<String> elements = Lists.newArrayList();
+		for (Object o : iter.getNextElements(n)) {
+			elements.add(gson.toJson(o));
+		}
+
+		final int to = iter.position();
+		final boolean end = iter.isFinished();
+		final int total = iter.getTotal();
+
+		return new ResultSetResponse(from, to, end, total, elements);
+	}
+
+	public ResultSetRegistry getRegistry() {
+		return registry;
+	}
+
+	@Required
+	public void setRegistry(final ResultSetRegistry registry) {
+		this.registry = registry;
+	}
+}
Index: modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetRestController.java
===================================================================
--- modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetRestController.java	(revision 36362)
+++ modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetRestController.java	(revision 36363)
@@ -1,7 +1,5 @@
 package eu.dnetlib.enabling.resultSetManager;
 
-import java.util.List;
-
 import javax.annotation.Resource;
 
 import org.springframework.web.bind.annotation.PathVariable;
@@ -9,36 +7,20 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.google.common.collect.Lists;
-import com.google.gson.Gson;
-
 import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse;
 import eu.dnetlib.rmi.rest.ResultSetService;
+import eu.dnetlib.rmi.soap.exceptions.ResultSetException;
 
 @RestController
 @RequestMapping("/rest/rs")
 public class ResultSetRestController implements ResultSetService {
 
-	@Resource(name = "newResultSetRegistry")
-	private ResultSetRegistry registry;
+	@Resource
+	private ResultSetServiceCore core;
 
 	@Override
 	@RequestMapping(value = "/{rsId}/{n}", method = RequestMethod.GET)
-	public ResultSetResponse getNextResults(@PathVariable final String rsId, @PathVariable final int n) {
-		final ResultSetIterator<?> iter = registry.findIterator(rsId);
-
-		final int from = iter.position();
-		final Gson gson = new Gson();
-
-		final List<String> elements = Lists.newArrayList();
-		for (Object o : iter.getNextElements(n)) {
-			elements.add(gson.toJson(o));
-		}
-
-		final int to = iter.position();
-		final boolean end = iter.isFinished();
-		final int total = iter.getTotal();
-
-		return new ResultSetResponse(from, to, end, total, elements);
+	public ResultSetResponse getNextResults(@PathVariable final String rsId, @PathVariable final int n) throws ResultSetException {
+		return core.getNextResults(rsId, n);
 	}
 }
Index: modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetServiceImpl.java
===================================================================
--- modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetServiceImpl.java	(revision 36362)
+++ modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/resultSetManager/ResultSetServiceImpl.java	(revision 36363)
@@ -1,8 +1,28 @@
 package eu.dnetlib.enabling.resultSetManager;
 
+import org.springframework.beans.factory.annotation.Required;
+
 import eu.dnetlib.common.services.AbstractBaseService;
+import eu.dnetlib.rmi.objects.resultSet.ResultSetResponse;
 import eu.dnetlib.rmi.soap.ResultSetService;
+import eu.dnetlib.rmi.soap.exceptions.ResultSetException;
 
 public class ResultSetServiceImpl extends AbstractBaseService implements ResultSetService {
 
+	private ResultSetServiceCore core;
+
+	@Override
+	public ResultSetResponse getNextResults(final String rsId, final int n) throws ResultSetException {
+		return core.getNextResults(rsId, n);
+	}
+
+	public ResultSetServiceCore getCore() {
+		return core;
+	}
+
+	@Required
+	public void setCore(final ResultSetServiceCore core) {
+		this.core = core;
+	}
+
 }
Index: modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/enabling/resultSetManager/applicationContext-resultSet-service.properties
===================================================================
--- modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/enabling/resultSetManager/applicationContext-resultSet-service.properties	(nonexistent)
+++ modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/enabling/resultSetManager/applicationContext-resultSet-service.properties	(revision 36363)
@@ -0,0 +1 @@
+dnet.resultsets.cache.conf = maximumSize=300, expireAfterAccess=10m, expireAfterWrite=1h
\ No newline at end of file
Index: modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/enabling/resultSetManager/applicationContext-resultSet-service.xml
===================================================================
--- modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/enabling/resultSetManager/applicationContext-resultSet-service.xml	(revision 36362)
+++ modules/dnet-node-services/trunk/src/main/resources/eu/dnetlib/enabling/resultSetManager/applicationContext-resultSet-service.xml	(revision 36363)
@@ -14,6 +14,7 @@
 	<!-- service beans -->
 	<bean id="newResultSetService" 
 		class="eu.dnetlib.enabling.resultSetManager.ResultSetServiceImpl"
+		p:core-ref="newResultSetCore"
 		p:mainProtocol="REST">
 		<property name="protocols">
 			<map>
@@ -29,8 +30,18 @@
 		address="/rs" />
 		
 	<!-- Other beans -->
+	<bean id="newResultSetCore"
+		class="eu.dnetlib.enabling.resultSetManager.ResultSetServiceCore"
+		p:registry-ref="newResultSetRegistry" />
+	
 	<bean id="newResultSetRegistry"
-		class="eu.dnetlib.enabling.resultSetManager.ResultSetRegistry" />
+		class="eu.dnetlib.enabling.resultSetManager.ResultSetRegistry">
+		<property name="cacheBuilder">
+			<bean class="com.google.common.cache.CacheBuilder" factory-method="from">
+				<constructor-arg value="${dnet.resultsets.cache.conf}" />
+			</bean>
+		</property>
+	</bean>
 	
 	<bean id="newResultSetFactory"
 		class="eu.dnetlib.enabling.resultSetManager.ResultSetFactory"
