Polish "Improve cache auto-configuration for Redis"

Closes gh-10944
This commit is contained in:
Stephane Nicoll
2017-11-10 14:42:50 +01:00
parent 9ffda68af8
commit 46ef178f04
5 changed files with 39 additions and 41 deletions

View File

@@ -77,6 +77,10 @@ content into your application; rather pick only the properties that you need.
spring.cache.infinispan.config= # The location of the configuration file to use to initialize Infinispan.
spring.cache.jcache.config= # The location of the configuration file to use to initialize the cache manager.
spring.cache.jcache.provider= # Fully qualified name of the CachingProvider implementation to use to retrieve the JSR-107 compliant cache manager. Only needed if more than one JSR-107 implementation is available on the classpath.
spring.cache.redis.cache-null-values=true # Allow caching null values.
spring.cache.redis.key-prefix= # Key prefix.
spring.cache.redis.time-to-live=0 # Entry expiration in milliseconds. By default the entries never expire.
spring.cache.redis.use-key-prefix=true # Whether to use the key prefix when writing to Redis.
spring.cache.type= # Cache type, auto-detected according to the environment by default.
# SPRING CONFIG - using environment property only ({sc-spring-boot}/context/config/ConfigFileApplicationListener.{sc-ext}[ConfigFileApplicationListener])

View File

@@ -4546,9 +4546,17 @@ This sample configuration reuses the `Cluster` that was created via auto-configu
[[boot-features-caching-provider-redis]]
==== Redis
If Redis is available and configured, the `RedisCacheManager` is auto-configured. It is
also possible to create additional caches on startup by setting the
`spring.cache.cache-names` property.
If Redis is available and configured, a `RedisCacheManager` is auto-configured. It is
possible to create additional caches on startup by setting the
`spring.cache.cache-names` property and cache defaults can be configured using
`spring.redis.cache.*` properties. For instance, the following configuration creates
`cache1` and `cache2` caches with a _time to live_ of 10 minutes:
[source,properties,indent=0]
----
spring.cache.cache-names=cache1,cache2
spring.cache.redis.time-to-live=600000
----
[NOTE]
====