From b7dc56f1c7a20115aeb4c4af3f7ea165a30677c9 Mon Sep 17 00:00:00 2001 From: Viacheslav Kolesnyk <94473337+viacheslavkol@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:01:45 +0100 Subject: [PATCH] fix(browse): Fix issue with old browse config being used (#711) * fix(browse): Remove browse config caching - Remove the caching to fix issue with old browse config being used Closes: MSEARCH-897 --- NEWS.md | 1 + .../org/folio/search/configuration/SearchCacheNames.java | 1 - .../folio/search/service/config/BrowseConfigService.java | 7 ------- src/main/resources/application.yml | 1 - src/test/resources/application.yml | 1 - 5 files changed, 1 insertion(+), 10 deletions(-) diff --git a/NEWS.md b/NEWS.md index 8fecdee5a..9c3f7118c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,6 +16,7 @@ * Change browse_config type_ids column type from varchar to array ([MSEARCH-890](https://folio-org.atlassian.net/browse/MSEARCH-890)) * Fix old browse config returned on get after upsert ([MSEARCH-897](https://folio-org.atlassian.net/browse/MSEARCH-897)) * Fix generation of IDs ranges in Reindex Upload for Subject, Classification and Contributor ([MSEARCH-907](https://folio-org.atlassian.net/browse/MSEARCH-907)) +* Remove browse config caching ([MSEARCH-897](https://folio-org.atlassian.net/browse/MSEARCH-897)) ### Tech Dept * Description ([ISSUE](https://folio-org.atlassian.net/browse/ISSUE)) diff --git a/src/main/java/org/folio/search/configuration/SearchCacheNames.java b/src/main/java/org/folio/search/configuration/SearchCacheNames.java index 3f64c2eab..a02dd8d9e 100644 --- a/src/main/java/org/folio/search/configuration/SearchCacheNames.java +++ b/src/main/java/org/folio/search/configuration/SearchCacheNames.java @@ -8,7 +8,6 @@ public class SearchCacheNames { public static final String ES_INDICES_CACHE = "es-indices"; public static final String REFERENCE_DATA_CACHE = "reference-data-cache"; - public static final String BROWSE_CONFIG_CACHE = "browse-config-cache"; public static final String RESOURCE_LANGUAGE_CACHE = "tenant-languages"; public static final String TENANT_FEATURES_CACHE = "tenant-features"; public static final String SEARCH_PREFERENCE_CACHE = "search-preference"; diff --git a/src/main/java/org/folio/search/service/config/BrowseConfigService.java b/src/main/java/org/folio/search/service/config/BrowseConfigService.java index af5bbcec1..0ded662f0 100644 --- a/src/main/java/org/folio/search/service/config/BrowseConfigService.java +++ b/src/main/java/org/folio/search/service/config/BrowseConfigService.java @@ -1,7 +1,6 @@ package org.folio.search.service.config; import static org.folio.search.client.InventoryReferenceDataClient.ReferenceDataType.CLASSIFICATION_TYPES; -import static org.folio.search.configuration.SearchCacheNames.BROWSE_CONFIG_CACHE; import java.util.ArrayList; import java.util.List; @@ -24,8 +23,6 @@ import org.folio.search.model.config.BrowseConfigId; import org.folio.search.repository.BrowseConfigEntityRepository; import org.folio.search.utils.CollectionUtils; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -46,8 +43,6 @@ public BrowseConfigCollection getConfigs(@NonNull BrowseType type) { return mapper.convert(repository.findByConfigId_BrowseType(type.getValue())); } - @Cacheable(cacheNames = BROWSE_CONFIG_CACHE, - key = "@folioExecutionContext.tenantId + ':' + #type.value + ':' + #optionType.value") public BrowseConfig getConfig(@NonNull BrowseType type, @NonNull BrowseOptionType optionType) { var typeValue = type.getValue(); var optionTypeValue = optionType.getValue(); @@ -59,7 +54,6 @@ public BrowseConfig getConfig(@NonNull BrowseType type, @NonNull BrowseOptionTyp "Config for %s type %s must be present in database".formatted(typeValue, optionTypeValue))); } - @CacheEvict(cacheNames = BROWSE_CONFIG_CACHE, allEntries = true) public void upsertConfig(@NonNull BrowseType type, @NonNull BrowseOptionType optionType, @NonNull BrowseConfig config) { @@ -73,7 +67,6 @@ public void upsertConfig(@NonNull BrowseType type, } @Transactional - @CacheEvict(cacheNames = BROWSE_CONFIG_CACHE, allEntries = true) public void deleteTypeIdsFromConfigs(@NonNull BrowseType type, @NonNull List typeIds) { if (typeIds.isEmpty()) { return; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 700a4aeee..5d023292c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -47,7 +47,6 @@ spring: cache-names: - es-indices - reference-data-cache - - browse-config-cache - tenant-languages - tenant-features - search-preference diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 37446502d..3b3adbdc9 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -32,7 +32,6 @@ spring: cache-names: - es-indices - reference-data-cache - - browse-config-cache - tenant-languages - tenant-features - search-preference