diff --git a/backend/src/main/java/com/bi/constant/RedisCacheKey.java b/backend/src/main/java/com/bi/constant/RedisCacheKey.java index 7786215..b92829e 100644 --- a/backend/src/main/java/com/bi/constant/RedisCacheKey.java +++ b/backend/src/main/java/com/bi/constant/RedisCacheKey.java @@ -5,6 +5,7 @@ private RedisCacheKey() { } + public static final String CACHE_PARAM = "#userId"; public static final String GET_COFFEE_LISTINGS_KEY = "getCoffeeListings"; public static final String GET_USER_COFFEE_LISTINGS_KEY = "getUserCoffeeListings"; public static final String GET_FILTERED_COFFEE_LISTINGS_KEY = "getFilteredCoffeeListings"; diff --git a/backend/src/main/java/com/bi/service/impl/CoffeeListingServiceImpl.java b/backend/src/main/java/com/bi/service/impl/CoffeeListingServiceImpl.java index 1f5137a..787f62f 100644 --- a/backend/src/main/java/com/bi/service/impl/CoffeeListingServiceImpl.java +++ b/backend/src/main/java/com/bi/service/impl/CoffeeListingServiceImpl.java @@ -38,7 +38,7 @@ public List getCoffeeListings() { } @Override - @Cacheable(value = RedisCacheKey.GET_USER_COFFEE_LISTINGS_KEY, key = "#userId") + @Cacheable(value = RedisCacheKey.GET_USER_COFFEE_LISTINGS_KEY, key = RedisCacheKey.CACHE_PARAM) public List getCoffeeListingsByUserId(String userId) { List userCoffeeListings = this.coffeeListingRepo.findByUserProfileUserId(userId); return userCoffeeListings.stream() diff --git a/backend/src/main/java/com/bi/service/impl/RecipeServiceImpl.java b/backend/src/main/java/com/bi/service/impl/RecipeServiceImpl.java index 1700f14..013e7c0 100644 --- a/backend/src/main/java/com/bi/service/impl/RecipeServiceImpl.java +++ b/backend/src/main/java/com/bi/service/impl/RecipeServiceImpl.java @@ -37,7 +37,7 @@ public List getRecipes() { } @Override - @Cacheable(value = RedisCacheKey.GET_USER_RECIPES_KEY, key = "#userId") + @Cacheable(value = RedisCacheKey.GET_USER_RECIPES_KEY, key = RedisCacheKey.CACHE_PARAM) public List getCoffeeRecipesByUserId(String userId) { List userRecipes = this.recipeRepo.findByUserProfileUserId(userId); return userRecipes.stream()