diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/DictionaryApplication.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/DictionaryApplication.java index c12b6eb..40fee56 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/DictionaryApplication.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/DictionaryApplication.java @@ -2,8 +2,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cache.annotation.EnableCaching; @SpringBootApplication +@EnableCaching public class DictionaryApplication { public static void main(String[] args) { diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptService.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptService.java index f22b65e..edd1e4d 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptService.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptService.java @@ -6,6 +6,7 @@ import edu.harvard.dbmi.avillach.dictionary.concept.model.ContinuousConcept; import edu.harvard.dbmi.avillach.dictionary.filter.Filter; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -26,6 +27,7 @@ public ConceptService(ConceptRepository conceptRepository, ConceptDecoratorServi this.conceptDecoratorService = conceptDecoratorService; } + @Cacheable("concepts") public List listConcepts(Filter filter, Pageable page) { return conceptRepository.getConcepts(filter, page); } @@ -40,6 +42,7 @@ public List listDetailedConcepts(Filter filter, Pageable page) { }).toList(); } + @Cacheable("concepts_count") public long countConcepts(Filter filter) { return conceptRepository.countConcepts(filter); } diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/facet/FacetService.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/facet/FacetService.java index b330865..3ad2aac 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/facet/FacetService.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/facet/FacetService.java @@ -2,6 +2,7 @@ import edu.harvard.dbmi.avillach.dictionary.filter.Filter; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.util.List; @@ -17,6 +18,7 @@ public FacetService(FacetRepository repository) { this.repository = repository; } + @Cacheable("facets") public List getFacets(Filter filter) { return repository.getFacets(filter); }