Improve RedisCacheManagerBuilder to expose applied RedisCacheConfiguration.

Now it is possible to construct a new, custom default RedisCacheConfiguration from an existing, default RedisCacheConfiguration.

This is useful in a Spring Boot context using the RedisCacheManagerBuilderCustomizer and acquiring access to the default RedisCacheConfiguration, which likely originated from Spring Boot Redis CacheProperties.

Resolves #2583
This commit is contained in:
Yanming Zhou
2023-05-18 10:35:23 +08:00
committed by John Blum
parent 21450a953b
commit 9f98f0d5fa
2 changed files with 24 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ import org.springframework.util.Assert;
*
* @author Christoph Strobl
* @author Mark Paluch
* @author Yanming Zhou
* @since 2.0
* @see RedisCacheConfiguration
* @see RedisCacheWriter
@@ -336,6 +337,15 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
return this;
}
/**
* Returns applied {@link RedisCacheConfiguration}, allow customization base on it.
*
* @return applied {@link RedisCacheConfiguration}.
*/
public RedisCacheConfiguration cacheDefaults() {
return this.defaultCacheConfiguration;
}
/**
* Configure a {@link RedisCacheWriter}.
*