Skip to content

Conversation

@joshydavid
Copy link
Owner

@joshydavid joshydavid commented Jul 27, 2025

Description

What type of PR is this?

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ‘¨πŸ»β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Desktop and mobile screenshots/recordings

Signed-off-by: joshydavid <cxang.2022@scis.smu.edu.sg>
@joshydavid joshydavid requested a review from Copilot July 27, 2025 10:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors Redis cache annotation parameters to improve code maintainability by extracting the hardcoded #userId parameter into a constant. This eliminates duplicate string literals and centralizes cache parameter definitions.

  • Introduces a new constant CACHE_PARAM in the RedisCacheKey class to represent the #userId cache key parameter
  • Updates @Cacheable annotations in service implementations to use the new constant instead of hardcoded strings

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
backend/src/main/java/com/bi/constant/RedisCacheKey.java Adds new CACHE_PARAM constant for cache key parameter
backend/src/main/java/com/bi/service/impl/RecipeServiceImpl.java Updates @Cacheable annotation to use the new constant
backend/src/main/java/com/bi/service/impl/CoffeeListingServiceImpl.java Updates @Cacheable annotation to use the new constant
Comments suppressed due to low confidence (1)

backend/src/main/java/com/bi/constant/RedisCacheKey.java:8

  • [nitpick] The constant name CACHE_PARAM is too generic. Consider a more descriptive name like USER_ID_CACHE_KEY or USER_ID_PARAM to clearly indicate this parameter is specifically for user ID-based caching.
    public static final String CACHE_PARAM = "#userId";

@sonarqubecloud
Copy link

@joshydavid joshydavid merged commit 5350988 into master Jul 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant