🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Nothing
  2. B.It does not compile
  3. C.Every page for a city returns whatever page was cached first
  4. 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 →