Bird
0
0

Which annotation is correctly used to cache the result of a method in Spring Boot?

easy📝 Syntax Q3 of 15
Spring Boot - Caching
Which annotation is correctly used to cache the result of a method in Spring Boot?
A@CacheResult
B@Cacheable
C@CachePut
D@CacheEvict
Step-by-Step Solution
Solution:
  1. Step 1: Recall caching annotations

    @Cacheable caches method results; @CachePut updates cache; @CacheEvict removes cache; @CacheResult is not a Spring annotation.
  2. Step 2: Identify correct annotation for caching method result

    @Cacheable is used to cache the return value of a method.
  3. Final Answer:

    @Cacheable -> Option B
  4. Quick Check:

    Cache method result = @Cacheable [OK]
Quick Trick: Use @Cacheable to cache method results [OK]
Common Mistakes:
  • Confusing @CachePut with caching method result
  • Using @CacheResult which is not Spring Boot annotation
  • Mixing @CacheEvict purpose with caching

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes