public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
CacheManager backed by a Redis cache.
This cache manager creates caches by default upon first write. Empty caches are not visible on Redis due to how Redis
represents empty data structures.
Caches requiring a different RedisCacheConfiguration than the default configuration can be specified via
RedisCacheManager.RedisCacheManagerBuilder.withInitialCacheConfigurations(Map).RedisCacheConfiguration,
RedisCacheWriter| Modifier and Type | Class and Description |
|---|---|
static class |
RedisCacheManager.RedisCacheManagerBuilder
Configurator for creating
RedisCacheManager. |
| Constructor and Description |
|---|
RedisCacheManager(RedisCacheWriter cacheWriter,
RedisCacheConfiguration defaultCacheConfiguration)
|
RedisCacheManager(RedisCacheWriter cacheWriter,
RedisCacheConfiguration defaultCacheConfiguration,
boolean allowInFlightCacheCreation,
String... initialCacheNames)
|
RedisCacheManager(RedisCacheWriter cacheWriter,
RedisCacheConfiguration defaultCacheConfiguration,
Map<String,RedisCacheConfiguration> initialCacheConfigurations)
|
RedisCacheManager(RedisCacheWriter cacheWriter,
RedisCacheConfiguration defaultCacheConfiguration,
Map<String,RedisCacheConfiguration> initialCacheConfigurations,
boolean allowInFlightCacheCreation)
|
RedisCacheManager(RedisCacheWriter cacheWriter,
RedisCacheConfiguration defaultCacheConfiguration,
String... initialCacheNames)
|
| Modifier and Type | Method and Description |
|---|---|
static RedisCacheManager.RedisCacheManagerBuilder |
builder()
Entry point for builder style
RedisCacheManager configuration. |
static RedisCacheManager.RedisCacheManagerBuilder |
builder(RedisCacheWriter cacheWriter)
Entry point for builder style
RedisCacheManager configuration. |
static RedisCacheManager.RedisCacheManagerBuilder |
builder(RedisConnectionFactory connectionFactory)
Entry point for builder style
RedisCacheManager configuration. |
static RedisCacheManager |
create(RedisConnectionFactory connectionFactory)
Create a new
RedisCacheManager with defaults applied. |
protected RedisCache |
createRedisCache(String name,
RedisCacheConfiguration cacheConfig)
Configuration hook for creating
RedisCache with given name and cacheConfig. |
Map<String,RedisCacheConfiguration> |
getCacheConfigurations() |
protected RedisCache |
getMissingCache(String name) |
protected Collection<RedisCache> |
loadCaches() |
decorateCache, isTransactionAware, setTransactionAwareaddCache, afterPropertiesSet, getCache, getCacheNames, initializeCaches, lookupCachepublic RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration)
cacheWriter - must not be null.defaultCacheConfiguration - must not be null. Maybe just use
RedisCacheConfiguration.defaultCacheConfig().public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration, String... initialCacheNames)
cacheWriter - must not be null.defaultCacheConfiguration - must not be null. Maybe just use
RedisCacheConfiguration.defaultCacheConfig().initialCacheNames - optional set of known cache names that will be created with given
defaultCacheConfiguration.public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration, boolean allowInFlightCacheCreation, String... initialCacheNames)
cacheWriter - must not be null.defaultCacheConfiguration - must not be null. Maybe just use
RedisCacheConfiguration.defaultCacheConfig().allowInFlightCacheCreation - if set to true no new caches can be acquire at runtime but limited to
the given list of initial cache names.initialCacheNames - optional set of known cache names that will be created with given
defaultCacheConfiguration.public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration, Map<String,RedisCacheConfiguration> initialCacheConfigurations)
cacheWriter - must not be null.defaultCacheConfiguration - must not be null. Maybe just use
RedisCacheConfiguration.defaultCacheConfig().initialCacheConfigurations - Map of known cache names along with the configuration to use for those caches.
Must not be null.public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration, Map<String,RedisCacheConfiguration> initialCacheConfigurations, boolean allowInFlightCacheCreation)
cacheWriter - must not be null.defaultCacheConfiguration - must not be null. Maybe just use
RedisCacheConfiguration.defaultCacheConfig().initialCacheConfigurations - Map of known cache names along with the configuration to use for those caches.
Must not be null.allowInFlightCacheCreation - if set to false this cache manager is limited to the initial cache
configurations and will not create new caches at runtime.public static RedisCacheManager create(RedisConnectionFactory connectionFactory)
RedisCacheManager with defaults applied.
RedisCacheConfiguration.defaultCacheConfig()connectionFactory - must not be null.RedisCacheManager.public static RedisCacheManager.RedisCacheManagerBuilder builder()
RedisCacheManager configuration.RedisCacheManager.RedisCacheManagerBuilder.public static RedisCacheManager.RedisCacheManagerBuilder builder(RedisConnectionFactory connectionFactory)
RedisCacheManager configuration.connectionFactory - must not be null.RedisCacheManager.RedisCacheManagerBuilder.public static RedisCacheManager.RedisCacheManagerBuilder builder(RedisCacheWriter cacheWriter)
RedisCacheManager configuration.cacheWriter - must not be null.RedisCacheManager.RedisCacheManagerBuilder.protected Collection<RedisCache> loadCaches()
loadCaches in class AbstractCacheManagerprotected RedisCache getMissingCache(String name)
getMissingCache in class AbstractCacheManagerpublic Map<String,RedisCacheConfiguration> getCacheConfigurations()
Map containing cache name / configuration pairs. Never null.protected RedisCache createRedisCache(String name, @Nullable RedisCacheConfiguration cacheConfig)
RedisCache with given name and cacheConfig.name - must not be null.cacheConfig - can be null.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.