Skip to content

Commit

Permalink
Provide more information about using spring.cache.type=none
Browse files Browse the repository at this point in the history
Closes gh-33694
  • Loading branch information
snicoll committed Aug 14, 2023
1 parent 46773dd commit 0e6abd1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ If you have not defined a bean of type `CacheManager` or a `CacheResolver` named

Additionally, {spring-boot-for-apache-geode}[Spring Boot for Apache Geode] provides {spring-boot-for-apache-geode-docs}#geode-caching-provider[auto-configuration for using Apache Geode as a cache provider].

TIP: It is also possible to _force_ a particular cache provider by setting the configprop:spring.cache.type[] property.
Use this property if you need to <<io#io.caching.provider.none,disable caching altogether>> in certain environments (such as tests).
TIP: If the `CacheManager` is auto-configured by Spring Boot, it is possible to _force_ a particular cache provider by setting the configprop:spring.cache.type[] property.
Use this property if you need to <<io#io.caching.provider.none,use no-op caches>> in certain environments (such as tests).

TIP: Use the `spring-boot-starter-cache` "`Starter`" to quickly add basic caching dependencies.
The starter brings in `spring-context-support`.
Expand Down Expand Up @@ -269,7 +269,10 @@ This is similar to the way the "real" cache providers behave if you use an undec
[[io.caching.provider.none]]
==== None
When `@EnableCaching` is present in your configuration, a suitable cache configuration is expected as well.
If you need to disable caching altogether in certain environments, force the cache type to `none` to use a no-op implementation, as shown in the following example:
If you have a custom `CacheManager`, consider defining it in a separate `@Configuration` class so that you can override it if necessary.
None uses a no-op implementation that is useful in tests, and slice tests use that by default via `@AutoConfigureCache`.

If you need to use a no-op cache rather than the auto-configured cache manager in a certain environment, set the cache type to `none`, as shown in the following example:

[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
Expand Down

0 comments on commit 0e6abd1

Please sign in to comment.