Skip to content
Snippets Groups Projects
Commit 0496b343 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

add caching to experiments

parent d8dbb9c5
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,9 @@ import eu.hbp.mip.repositories.ModelRepository;
import eu.hbp.mip.utils.JSONUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
......@@ -72,6 +75,8 @@ public class ExperimentApi {
@ApiOperation(value = "Send a request to the workflow to run an experiment", response = Experiment.class)
@CachePut("exp")
@CacheEvict(value = "exps", allEntries = true)
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<String> runExperiment(@RequestBody ExperimentQuery expQuery) {
LOGGER.info("Run an experiment");
......@@ -104,6 +109,7 @@ public class ExperimentApi {
}
@ApiOperation(value = "get an experiment", response = Experiment.class)
@Cacheable("exp")
@RequestMapping(value = "/{uuid}", method = RequestMethod.GET)
public ResponseEntity<String> getExperiment(@ApiParam(value = "uuid", required = true) @PathVariable("uuid") String uuid) {
LOGGER.info("Get an experiment");
......@@ -171,6 +177,7 @@ public class ExperimentApi {
}
@ApiOperation(value = "list experiments", response = Experiment.class, responseContainer = "List")
@Cacheable("exps")
@RequestMapping(value = "/mine", method = RequestMethod.GET, params = {"maxResultCount"})
public ResponseEntity<String> listExperiments(
@ApiParam(value = "maxResultCount", required = false) @RequestParam int maxResultCount
......@@ -196,6 +203,7 @@ public class ExperimentApi {
}
@ApiOperation(value = "List available methods and validations", response = String.class)
@Cacheable("methods")
@RequestMapping(path = "/methods", method = RequestMethod.GET)
public ResponseEntity<String> listAvailableMethodsAndValidations() throws IOException {
LOGGER.info("List available methods and validations");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment