Skip to content

Commit 5d62dee

Browse files
committed
Fixed cache-evict for concept set delete.
Changed asset cache key to use login always due to read/write permissions being assigned at a per-user basis.
1 parent 0a77f67 commit 5d62dee

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/java/org/ohdsi/webapi/service/CohortDefinitionService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ public GenerateSqlResult generateSql(GenerateSqlRequest request) {
431431
@Path("/")
432432
@Produces(MediaType.APPLICATION_JSON)
433433
@Transactional
434-
@Cacheable(cacheNames = CachingSetup.COHORT_DEFINITION_LIST_CACHE, key = "@permissionService.getAssetListCacheKey()")
434+
@Cacheable(cacheNames = CachingSetup.COHORT_DEFINITION_LIST_CACHE, key = "@permissionService.getSubjectCacheKey()")
435435
public List<CohortMetadataDTO> getCohortDefinitionList() {
436436
List<CohortDefinition> definitions = cohortDefinitionRepository.list();
437437
return definitions.stream()

src/main/java/org/ohdsi/webapi/service/ConceptSetService.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public ConceptSetDTO getConceptSet(@PathParam("id") final int id) {
162162
@GET
163163
@Path("/")
164164
@Produces(MediaType.APPLICATION_JSON)
165-
@Cacheable(cacheNames = ConceptSetService.CachingSetup.CONCEPT_SET_LIST_CACHE, key = "@permissionService.getAssetListCacheKey()")
165+
@Cacheable(cacheNames = ConceptSetService.CachingSetup.CONCEPT_SET_LIST_CACHE, key = "@permissionService.getSubjectCacheKey()")
166166
public Collection<ConceptSetDTO> getConceptSets() {
167167
return getTransactionTemplate().execute(
168168
transactionStatus -> StreamSupport.stream(getConceptSetRepository().findAll().spliterator(), false)
@@ -481,7 +481,7 @@ public Response exportConceptSetToCSV(@PathParam("id") final String id) throws E
481481
@POST
482482
@Consumes(MediaType.APPLICATION_JSON)
483483
@Produces(MediaType.APPLICATION_JSON)
484-
@CacheEvict(cacheNames = CachingSetup.CONCEPT_SET_LIST_CACHE, allEntries = true)
484+
@CacheEvict(cacheNames = CachingSetup.CONCEPT_SET_LIST_CACHE, allEntries = true)
485485
public ConceptSetDTO createConceptSet(ConceptSetDTO conceptSetDTO) {
486486

487487
UserEntity user = userRepository.findByLogin(security.getSubject());
@@ -609,6 +609,7 @@ public Collection<ConceptSetGenerationInfo> getConceptSetGenerationInfo(@PathPar
609609
@DELETE
610610
@Transactional(rollbackOn = Exception.class, dontRollbackOn = EmptyResultDataAccessException.class)
611611
@Path("{id}")
612+
@CacheEvict(cacheNames = CachingSetup.CONCEPT_SET_LIST_CACHE, allEntries = true)
612613
public void deleteConceptSet(@PathParam("id") final int id) {
613614
// Remove any generation info
614615
try {
@@ -656,6 +657,7 @@ public void deleteConceptSet(@PathParam("id") final int id) {
656657
@Produces(MediaType.APPLICATION_JSON)
657658
@Path("/{id}/tag/")
658659
@Transactional
660+
@CacheEvict(cacheNames = CachingSetup.CONCEPT_SET_LIST_CACHE, allEntries = true)
659661
public void assignTag(@PathParam("id") final Integer id, final int tagId) {
660662
ConceptSet entity = getConceptSetRepository().findById(id);
661663
checkOwnerOrAdminOrGranted(entity);

0 commit comments

Comments
 (0)