Bird
0
0

What does the @CacheEvict annotation do in a Spring Boot application?

easy📝 Conceptual Q1 of 15
Spring Boot - Caching
What does the @CacheEvict annotation do in a Spring Boot application?
AAdds new entries to the cache automatically
BRemoves one or more entries from the cache to keep data fresh
CDisables caching for the annotated method
DCreates a new cache with the specified name
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of @CacheEvict

    @CacheEvict is used to remove cache entries to avoid stale data.
  2. Step 2: Compare options with the purpose

    Only Removes one or more entries from the cache to keep data fresh correctly describes removing entries to keep cache fresh.
  3. Final Answer:

    Removes one or more entries from the cache to keep data fresh -> Option B
  4. Quick Check:

    @CacheEvict purpose = Remove cache entries [OK]
Quick Trick: Evict means remove cache entries to refresh data [OK]
Common Mistakes:
  • Thinking @CacheEvict adds cache entries
  • Confusing @CacheEvict with @CachePut
  • Assuming it disables caching

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes