# Caching con Spring (Spring Boot) > Caching con Spring: @Cacheable, @CacheEvict, @CachePut, CacheManager, proveedores (EhCache, Redis, Caffeine) - 25 preguntas de entrevista - Mid-Level - [Preguntas de entrevista: Spring Boot](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista.md) ## 1. ¿Cuál es el rol principal de la anotación @Cacheable en Spring? **Respuesta** @Cacheable almacena en caché el resultado de un método para evitar ejecuciones repetidas con los mismos parámetros. Esto mejora significativamente el rendimiento en operaciones costosas como consultas a base de datos o llamadas a APIs externas. Usa @Cacheable en métodos de lectura llamados frecuentemente con los mismos argumentos para reducir la carga sobre los recursos. ## 2. ¿Qué anotación es necesaria para habilitar el soporte de caching en una aplicación Spring Boot? **Respuesta** @EnableCaching activa el soporte de caching en Spring Boot y debe colocarse en una clase de configuración (normalmente la clase principal anotada con @SpringBootApplication). Sin esta anotación, las anotaciones de caché como @Cacheable serán ignoradas. Spring Boot configura automáticamente un CacheManager en memoria simple (ConcurrentMapCacheManager) si no se define ningún otro. ## 3. ¿Cuál es la diferencia principal entre @Cacheable y @CachePut? **Respuesta** @Cacheable omite la ejecución del método si el resultado ya está en caché, mientras que @CachePut siempre ejecuta el método y actualiza el caché con el nuevo resultado. Usa @Cacheable para lecturas (evitar cálculos repetidos) y @CachePut para operaciones de actualización que deben refrescar el caché sin omitir la ejecución del método. ## 22 preguntas más disponibles - ¿Cuál es el rol de la anotación @CacheEvict en Spring? - ¿Qué CacheManager configura Spring Boot por defecto si no se define ningún otro? Regístrate gratis: https://sharpskill.dev/es/login ## Otros temas de entrevista Spring Boot - [Spring Core - IoC & DI](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-core-ioc-di.md): 22 preguntas, Junior - [Spring Boot Auto-Configuration](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-boot-auto-configuration.md): 20 preguntas, Junior - [Spring Boot Starters](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-boot-starters.md): 18 preguntas, Junior - [Application Properties & YAML](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/application-properties-yml.md): 16 preguntas, Junior - [Logging con SLF4J y Logback](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/logging.md): 20 preguntas, Junior - [Spring Boot DevTools](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-boot-devtools.md): 15 preguntas, Junior - [Spring MVC Basics](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-mvc-basics.md): 20 preguntas, Mid-Level - [Spring REST Controllers](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-rest-controllers.md): 20 preguntas, Mid-Level - [Request & Response Handling](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/request-response-handling.md): 20 preguntas, Mid-Level - [Manejo de excepciones](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/exception-handling.md): 25 preguntas, Mid-Level - [Bean Validation](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/bean-validation.md): 25 preguntas, Mid-Level - [Fundamentos de Spring Data JPA](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-data-jpa-basics.md): 25 preguntas, Mid-Level - [Entidades JPA y relaciones](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/jpa-entities-relationships.md): 30 preguntas, Mid-Level - [Consultas JPA](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/jpa-queries.md): 30 preguntas, Mid-Level - [Spring Data Repositories](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-data-repositories.md): 25 preguntas, Mid-Level - [Fundamentos de Spring Security](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-security-basics.md): 25 preguntas, Mid-Level - [Spring Boot Actuator](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-boot-actuator.md): 20 preguntas, Mid-Level - [Pruebas unitarias con JUnit y Mockito](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/testing-junit-mockito.md): 30 preguntas, Mid-Level - [Testing en Spring Boot](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-boot-testing.md): 30 preguntas, Mid-Level - [Profiles y Environment](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/profiles-environment.md): 20 preguntas, Mid-Level - [RestTemplate y WebClient](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/resttemplate-webclient.md): 24 preguntas, Mid-Level - [Async y Scheduling](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/async-scheduling.md): 25 preguntas, Mid-Level - [Spring WebFlux (Reactive)](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-webflux.md): 25 preguntas, Mid-Level - [Transacciones de Spring](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/transactions.md): 30 preguntas, Senior - [Autenticación y autorización avanzadas](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/authentication-authorization.md): 30 preguntas, Senior - [JWT y seguridad stateless](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/jwt-stateless-security.md): 20 preguntas, Senior - [OAuth2 y Authorization Server](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/oauth2-authorization-server.md): 20 preguntas, Senior - [Spring Boot y Docker](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-boot-docker.md): 19 preguntas, Senior - [Microservices con Spring](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/microservices-basics.md): 25 preguntas, Senior - [Spring Cloud Config](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/spring-cloud-config.md): 19 preguntas, Senior - [Optimización del rendimiento](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/performance-optimization.md): 30 preguntas, Senior - [GraalVM Native Images](https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/graalvm-native-images.md): 20 preguntas, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/es/technologies/spring-boot/preguntas-entrevista/caching