Loading tutorials
application.properties or application.yml live6 min readapplication.properties. The previous chapter explained the Cache and CacheManager interfaces. This chapter shows how to swi5 min read@Cacheable is the annotation that does most of the work in Spring's cache abstraction. This chapter covers what it does at runtime, which attributes you will use most, and the behaviors that surprise people. It assumes you can build a Spring Boot service with Maven or Gradle and that you know how 4 min read@Cacheable, build a key with SpEL, and run a Spring Boot application with caching enabled. By default @Cacheable stores every result for every call. Often that is wrong. Some calls are not worth caching, and some results should never be5 min read@Cacheable fills the cache, but it never notices when the underlying data changes. If a product's price is updated in the database, the cached copy stays wrong until it expires. This chapter covers the two annotations that keep a cache in step with writes, and the patterns that cover their gaps.5 min read@Cacheable on a service method. Here you will learn why caching annotations only work on some calls, how to recognize the failure, and how to fix it.5 min readapplication.properties. You should also have used @EnableCaching and @Cacheable. The chapter covers how Spring Boot picks a provider, what the main options are, and ho6 min read@Cacheable, @CachePut and @CacheEvict, that you know how @EnableCaching works, and that you can edit application.properties and your Maven or Gradle dependencies. T5 min read@Cacheable, and that you know what a CacheManager is and how Spring Boot picks a provider. Here you will learn how entries leave a cache: by time (expiration) or by pressure (eviction). You will also see how to configure both for Caffei5 min read@Cacheable, know how cache keys are built, and have a cache provider such as Caffeine or Redis configured. You should also know that Spring applies caching through a proxy. Here you will see what happens when many threads miss the same key at once, how `sync = true5 min read@EnableCaching, at least one @Cacheable method, and Caffeine or Redis configured as the provider. It also assumes you know how to add a Boot starter and edit application.properties. Here you will see what the c5 min read@Cacheable, @CachePut, @CacheEvict, and a provider such as Caffeine or Redis. Each section names 7 min read