← Quiz: Spring Boot Caching: all 10 questions
Quiz: Spring Boot Caching · Question 6 of 10
@Cacheable(cacheNames = "courses", key = "city") is on findCourses(String city, int page). What goes wrong?
@Cacheable(cacheNames = "courses", key = "#city") is on findCourses(String city, int page). What goes wrong?
- A.Nothing
- B.It does not compile
- C.Every page for a city returns whatever page was cached first
- D.The cache is never used
Answer & explanation
Correct answer: Every page for a city returns whatever page was cached first
The key ignores page, so page 1 and page 2 share one entry.
Can you get the rest right without peeking?
Take the timed Quiz: Spring Boot Caching quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →