Class CouchbaseCacheManager.CouchbaseCacheManagerBuilder
java.lang.Object
org.springframework.data.couchbase.cache.CouchbaseCacheManager.CouchbaseCacheManagerBuilder
- Enclosing class:
- CouchbaseCacheManager
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create new instance ofCouchbaseCacheManager
with configuration options applied.cacheDefaults
(CouchbaseCacheConfiguration defaultCacheConfiguration) Define a defaultCouchbaseCacheConfiguration
applied to dynamically createdCouchbaseCache
s.Disable in-flightCache
creation for unconfigured caches.fromCacheWriter
(CouchbaseCacheWriter cacheWriter) Entry point for builder styleCouchbaseCacheManager
configuration.fromConnectionFactory
(CouchbaseClientFactory clientFactory) Entry point for builder styleCouchbaseCacheManager
configuration.getCacheConfigurationFor
(String cacheName) Get theCouchbaseCacheConfiguration
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 currentCouchbaseCacheConfiguration
.EnableCouchbaseCache
s to synchronize cache put/evict operations with ongoing Spring-managed transactions.withCacheConfiguration
(String cacheName, CouchbaseCacheConfiguration cacheConfiguration) withInitialCacheConfigurations
(Map<String, CouchbaseCacheConfiguration> cacheConfigurations) Append aMap
of cache name/CouchbaseCacheConfiguration
pairs to be pre initialized.
-
Method Details
-
fromConnectionFactory
public static CouchbaseCacheManager.CouchbaseCacheManagerBuilder fromConnectionFactory(CouchbaseClientFactory clientFactory) Entry point for builder styleCouchbaseCacheManager
configuration.- Parameters:
clientFactory
- must not be null.- Returns:
- new
CouchbaseCacheManager.CouchbaseCacheManagerBuilder
.
-
fromCacheWriter
public static CouchbaseCacheManager.CouchbaseCacheManagerBuilder fromCacheWriter(CouchbaseCacheWriter cacheWriter) Entry point for builder styleCouchbaseCacheManager
configuration.- Parameters:
cacheWriter
- must not be null.- Returns:
- new
CouchbaseCacheManager.CouchbaseCacheManagerBuilder
.
-
cacheDefaults
public CouchbaseCacheManager.CouchbaseCacheManagerBuilder cacheDefaults(CouchbaseCacheConfiguration defaultCacheConfiguration) Define a defaultCouchbaseCacheConfiguration
applied to dynamically createdCouchbaseCache
s.- Parameters:
defaultCacheConfiguration
- must not be null.- Returns:
- this
CouchbaseCacheManager.CouchbaseCacheManagerBuilder
.
-
transactionAware
EnableCouchbaseCache
s to synchronize cache put/evict operations with ongoing Spring-managed transactions.- Returns:
- this
CouchbaseCacheManager.CouchbaseCacheManagerBuilder
.
-
initialCacheNames
Append aSet
of cache names to be pre initialized with currentCouchbaseCacheConfiguration
. NOTE: This calls depends oncacheDefaults(CouchbaseCacheConfiguration)
using whatever defaultCouchbaseCacheConfiguration
is present at the time of invoking this method.- Parameters:
cacheNames
- must not be null.- Returns:
- this
CouchbaseCacheManager.CouchbaseCacheManagerBuilder
.
-
withInitialCacheConfigurations
public CouchbaseCacheManager.CouchbaseCacheManagerBuilder withInitialCacheConfigurations(Map<String, CouchbaseCacheConfiguration> cacheConfigurations) Append aMap
of cache name/CouchbaseCacheConfiguration
pairs to be pre initialized.- Parameters:
cacheConfigurations
- must not be null.- Returns:
- this
CouchbaseCacheManager.CouchbaseCacheManagerBuilder
.
-
withCacheConfiguration
public CouchbaseCacheManager.CouchbaseCacheManagerBuilder withCacheConfiguration(String cacheName, CouchbaseCacheConfiguration cacheConfiguration) - Parameters:
cacheName
-cacheConfiguration
-- Returns:
- this
CouchbaseCacheManager.CouchbaseCacheManagerBuilder
.
-
disableCreateOnMissingCache
Disable in-flightCache
creation for unconfigured caches.CouchbaseCacheManager.getMissingCache(String)
returns null for any unconfiguredCache
instead of a newCouchbaseCache
instance. This allows eg.CompositeCacheManager
to chime in.- Returns:
- this
CouchbaseCacheManager.CouchbaseCacheManagerBuilder
.
-
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.
-
getCacheConfigurationFor
Get theCouchbaseCacheConfiguration
for a given cache by its name.- Parameters:
cacheName
- must not be null.- Returns:
Optional.empty()
if noCouchbaseCacheConfiguration
set for the given cache name.
-
build
Create new instance ofCouchbaseCacheManager
with configuration options applied.- Returns:
- new instance of
CouchbaseCacheManager
.
-