feat: 일부 조회 기능에 캐싱 관련 처리 도입 - #224
Conversation
📝 WalkthroughSummary by CodeRabbit변경 사항
📋 개요Walkthroughbuild.gradle.kts 파일에 Spring Boot 캐시 스타터 의존성( Changes
🎯 코드 리뷰 난이도🎯 1 (Trivial) | ⏱️ ~2분 🐰 Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@build.gradle.kts`:
- Around line 77-79: Add caching support by annotating the SmashingApplication
class with `@EnableCaching` so Spring will process
`@Cacheable/`@CacheEvict/@CachePut annotations; update the application-*.yml to
configure cache properties (spring.cache.type, redis.time-to-live,
key-prefix/use-key-prefix and serialization if using Redis) to ensure TTL and
key names are applied when using Redis as the cache store.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
|
|
||
| // Cache | ||
| implementation("org.springframework.boot:spring-boot-starter-cache") |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: `@EnableCaching` 어노테이션이 프로젝트 어딘가에 존재하는지 확인
echo "=== `@EnableCaching` 어노테이션 검색 ==="
rg -n "@EnableCaching" --type=kotlin
echo ""
echo "=== 캐시 관련 어노테이션 사용 현황 검색 ==="
rg -n "@Cacheable|@CacheEvict|@CachePut|@Caching" --type=kotlin
echo ""
echo "=== application*.yml 캐시 설정 확인 ==="
rg -n "cache:" src/main/resources/ || echo "캐시 설정 없음"Repository: TEAM-SMASHING/SMASHING-SERVER
Length of output: 178
🏁 Script executed:
#!/bin/bash
# Verify the spring-boot-starter-cache dependency in build.gradle.kts
echo "=== Checking build.gradle.kts for spring-boot-starter-cache ==="
sed -n '75,85p' build.gradle.kts
echo ""
echo "=== Checking SmashingApplication.kt imports and annotations ==="
head -20 src/main/kotlin/com/smashing/SmashingApplication.kt
echo ""
echo "=== Checking application-local.yml for Redis config ==="
cat src/main/resources/application-local.yml | grep -A 20 "redis:" || echo "No redis config found"
echo ""
echo "=== Checking if any `@Cache`* annotations exist in the entire codebase ==="
rg -r "@(Cacheable|CacheEvict|CachePut|Caching)" --type=kotlin
echo ""
echo "=== List all build.gradle.kts cache-related dependencies ==="
rg "cache|Cache" build.gradle.ktsRepository: TEAM-SMASHING/SMASHING-SERVER
Length of output: 1781
🏁 Script executed:
#!/bin/bash
# Find SmashingApplication.kt
echo "=== Finding SmashingApplication.kt ==="
fd "SmashingApplication.kt"
echo ""
echo "=== Checking directory structure ==="
find src -type f -name "*.kt" | head -20
echo ""
echo "=== Check project structure ==="
git ls-files | grep -i "application.kt" | head -10Repository: TEAM-SMASHING/SMASHING-SERVER
Length of output: 1897
🏁 Script executed:
#!/bin/bash
# Read SmashingApplication.kt to verify current state
echo "=== Content of SmashingApplication.kt ==="
cat src/main/kotlin/org/appjam/smashing/SmashingApplication.ktRepository: TEAM-SMASHING/SMASHING-SERVER
Length of output: 582
@EnableCaching 어노테이션 누락으로 캐싱이 활성화되지 않습니다.
spring-boot-starter-cache 의존성만 추가해서는 캐싱이 동작하지 않습니다. SmashingApplication.kt에 @EnableCaching 어노테이션을 추가해야 @Cacheable, @CacheEvict, @CachePut 등의 캐시 어노테이션이 실제로 동작합니다.
또한 application-*.yml에 캐시 관련 설정(TTL, 캐시 타입, 직렬화 방식 등)이 없습니다. Redis를 캐시 저장소로 사용할 경우 다음 설정을 추가하세요:
spring:
cache:
type: redis
redis:
time-to-live: 3600000 # 1시간 (밀리초)
key-prefix: "smashing:"
use-key-prefix: trueSmashingApplication.kt에 `@EnableCaching` 추가 예시
package org.appjam.smashing
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.context.properties.ConfigurationPropertiesScan
import org.springframework.boot.runApplication
import org.springframework.scheduling.annotation.EnableScheduling
+import org.springframework.cache.annotation.EnableCaching
`@EnableScheduling`
+@EnableCaching
`@SpringBootApplication`
`@ConfigurationPropertiesScan`
class SmashingApplication🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@build.gradle.kts` around lines 77 - 79, Add caching support by annotating the
SmashingApplication class with `@EnableCaching` so Spring will process
`@Cacheable/`@CacheEvict/@CachePut annotations; update the application-*.yml to
configure cache properties (spring.cache.type, redis.time-to-live,
key-prefix/use-key-prefix and serialization if using Redis) to ensure TTL and
key names are applied when using Redis as the cache store.
📌 Related Issue
#️⃣ 요약 설명
📝 작업 내용
👍 동작 확인
💬 리뷰 요구사항(선택)