Class RedisCacheManager.RedisCacheManagerBuilder
java.lang.Object
org.springframework.data.redis.cache.RedisCacheManager.RedisCacheManagerBuilder
- Enclosing class:
- RedisCacheManager
Configurator for creating
RedisCacheManager
.- Since:
- 2.0
- Author:
- Christoph Strobl, Mark Paluch, Kezhu Wang
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create new instance ofRedisCacheManager
with configuration options applied.cacheDefaults
(RedisCacheConfiguration defaultCacheConfiguration) Define a defaultRedisCacheConfiguration
applied to dynamically createdRedisCache
s.cacheWriter
(RedisCacheWriter cacheWriter) Configure aRedisCacheWriter
.Disable in-flightCache
creation for unconfigured caches.fromCacheWriter
(RedisCacheWriter cacheWriter) Entry point for builder styleRedisCacheManager
configuration.fromConnectionFactory
(RedisConnectionFactory connectionFactory) Entry point for builder styleRedisCacheManager
configuration.getCacheConfigurationFor
(String cacheName) Get theRedisCacheConfiguration
for a given cache by its name.Get theSet
of cache names for which the builder holdsconfiguration
.initialCacheNames
(Set<String> cacheNames) Append aSet
of cache names to be pre initialized with currentRedisCacheConfiguration
.EnableRedisCache
s to synchronize cache put/evict operations with ongoing Spring-managed transactions.withCacheConfiguration
(String cacheName, RedisCacheConfiguration cacheConfiguration) withInitialCacheConfigurations
(Map<String, RedisCacheConfiguration> cacheConfigurations) Append aMap
of cache name/RedisCacheConfiguration
pairs to be pre initialized.
-
Method Details
-
fromConnectionFactory
public static RedisCacheManager.RedisCacheManagerBuilder fromConnectionFactory(RedisConnectionFactory connectionFactory) Entry point for builder styleRedisCacheManager
configuration.- Parameters:
connectionFactory
- must not be null.- Returns:
- new
RedisCacheManager.RedisCacheManagerBuilder
.
-
fromCacheWriter
public static RedisCacheManager.RedisCacheManagerBuilder fromCacheWriter(RedisCacheWriter cacheWriter) Entry point for builder styleRedisCacheManager
configuration.- Parameters:
cacheWriter
- must not be null.- Returns:
- new
RedisCacheManager.RedisCacheManagerBuilder
.
-
cacheDefaults
public RedisCacheManager.RedisCacheManagerBuilder cacheDefaults(RedisCacheConfiguration defaultCacheConfiguration) Define a defaultRedisCacheConfiguration
applied to dynamically createdRedisCache
s.- Parameters:
defaultCacheConfiguration
- must not be null.- Returns:
- this
RedisCacheManager.RedisCacheManagerBuilder
.
-
cacheWriter
Configure aRedisCacheWriter
.- Parameters:
cacheWriter
- must not be null.- Returns:
- this
RedisCacheManager.RedisCacheManagerBuilder
. - Since:
- 2.3
-
transactionAware
EnableRedisCache
s to synchronize cache put/evict operations with ongoing Spring-managed transactions.- Returns:
- this
RedisCacheManager.RedisCacheManagerBuilder
.
-
initialCacheNames
Append aSet
of cache names to be pre initialized with currentRedisCacheConfiguration
. NOTE: This calls depends oncacheDefaults(RedisCacheConfiguration)
using whatever defaultRedisCacheConfiguration
is present at the time of invoking this method.- Parameters:
cacheNames
- must not be null.- Returns:
- this
RedisCacheManager.RedisCacheManagerBuilder
.
-
withInitialCacheConfigurations
public RedisCacheManager.RedisCacheManagerBuilder withInitialCacheConfigurations(Map<String, RedisCacheConfiguration> cacheConfigurations) Append aMap
of cache name/RedisCacheConfiguration
pairs to be pre initialized.- Parameters:
cacheConfigurations
- must not be null.- Returns:
- this
RedisCacheManager.RedisCacheManagerBuilder
.
-
withCacheConfiguration
public RedisCacheManager.RedisCacheManagerBuilder withCacheConfiguration(String cacheName, RedisCacheConfiguration cacheConfiguration) - Parameters:
cacheName
-cacheConfiguration
-- Returns:
- this
RedisCacheManager.RedisCacheManagerBuilder
. - Since:
- 2.2
-
disableCreateOnMissingCache
Disable in-flightCache
creation for unconfigured caches.RedisCacheManager.getMissingCache(String)
returns null for any unconfiguredCache
instead of a newRedisCache
instance. This allows eg.CompositeCacheManager
to chime in.- Returns:
- this
RedisCacheManager.RedisCacheManagerBuilder
. - Since:
- 2.0.4
-
getConfiguredCaches
Get theSet
of cache names for which the builder holdsconfiguration
.- Returns:
- an unmodifiable
Set
holding the name of caches for which aconfiguration
has been set. - Since:
- 2.2
-
getCacheConfigurationFor
Get theRedisCacheConfiguration
for a given cache by its name.- Parameters:
cacheName
- must not be null.- Returns:
Optional.empty()
if noRedisCacheConfiguration
set for the given cache name.- Since:
- 2.2
-
enableStatistics
- Returns:
- Since:
- 2.4
-
build
Create new instance ofRedisCacheManager
with configuration options applied.- Returns:
- new instance of
RedisCacheManager
.
-