Interview questions
Question 146 of 254
FreeHow does Spring's caching abstraction work, and what does @Cacheable do?
Caching & Scheduling
Spring's caching abstraction (`@EnableCaching` plus a configured CacheManager) lets you add caching declaratively via annotations rather than writing manual cache-check logic. `@Cacheable` on a method checks the configured cache for an entry matching a computed key (by default, derived from the method's arguments) before running the method — on a hit, it returns the cached value directly, skipping the method body entirely; on a miss, it runs the method and stores the result under that key for next time.
Intermediate5 min

