Bird
0
0

Consider this method:

medium📝 component behavior Q5 of 15
Spring Boot - Caching
Consider this method:
@CacheEvict(cacheNames = "orders", allEntries = true)
public void clearOrdersCache() { /* clear logic */ }

What is the effect of calling clearOrdersCache()?
ARemoves only the entry with key 'orders'
BRemoves entries only if condition is true
CDoes not remove any cache entries
DRemoves all entries from the 'orders' cache
Step-by-Step Solution
Solution:
  1. Step 1: Understand allEntries attribute

    Setting allEntries = true means all cache entries are removed.
  2. Step 2: Apply to 'orders' cache

    All entries in the 'orders' cache are cleared when the method is called.
  3. Final Answer:

    Removes all entries from the 'orders' cache -> Option D
  4. Quick Check:

    allEntries=true clears entire cache [OK]
Quick Trick: Use allEntries=true to clear entire cache [OK]
Common Mistakes:
  • Thinking only one entry is removed
  • Ignoring allEntries attribute
  • Confusing with condition attribute

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes