public class GemfireCacheManager extends AbstractCacheManager
CacheManager implementation backed by a Pivotal GemFire cache instance
(either a client or peer cache).
Automatically discovers available caches (or Pivotal GemFire Regions) when a cache for a given name
is missing and dynamic cache lookup/creation is enabled.Cache,
CacheManager,
AbstractCacheManager,
GemFireCache,
Region| Constructor and Description |
|---|
GemfireCacheManager() |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.geode.cache.GemFireCache |
getCache()
Returns the
GemFireCache instance backing this CacheManager. |
protected Cache |
getMissingCache(String name)
Returns a missing Spring
Cache for the given name. |
protected Set<org.apache.geode.cache.Region<?,?>> |
getRegions()
Returns the set of Pivotal GemFire
Regions used explicitly as Spring Caches
in Spring's caching infrastructure. |
protected boolean |
isDynamic()
Determines whether this
CacheManager allows the dynamic creation of a Cache at runtime. |
protected Collection<Cache> |
loadCaches()
Loads all configured Pivotal GemFire
Regions that will be used by this CacheManager. |
protected GemfireCache |
newGemfireCache(org.apache.geode.cache.Region<?,?> region)
Constructs a new instance of
GemfireCache initialized with the given Pivotal GemFire Region. |
void |
setCache(org.apache.geode.cache.GemFireCache gemfireCache)
Sets the Pivotal GemFire cache instance backing this
CacheManager. |
void |
setCacheNames(Set<String> cacheNames)
Sets the names of all Spring
Caches that will be used in the application. |
void |
setRegions(Set<org.apache.geode.cache.Region<?,?>> regions)
Explicitly sets the Pivotal GemFire
Regions to be used as Spring Caches
in the application. |
addCache, afterPropertiesSet, decorateCache, getCache, getCacheNames, initializeCaches, lookupCacheprotected Collection<Cache> loadCaches()
Regions that will be used by this CacheManager.
Any Pivotal GemFire Regions configured with the regions property will take precedence over
any configured cacheNames. If no Pivotal GemFire Regions were configured, then any
cacheNames that were specified will be used to lookup existing Pivotal GemFire Regions
to function as Spring Cachesin Spring's caching infrastructure.
However, if neither regions nor cacheNames were specified, then all defined GemFire
Regions declared in the Spring application context, as determined by
RegionService.rootRegions(), will be used as Spring Caches, and this CacheManager
will allow any dynamically created Pivotal GemFire Regions at runtime to be found and used as a
Spring Cache as well.loadCaches in class AbstractCacheManagerCollection of Pivotal GemFire Regions used by this CacheManager
to function as Caches in Spring's caching infrastructure.IllegalStateException - if a Pivotal GemFire cache instance was not provided, the provided Pivotal GemFire cache instance
has been closed, no Pivotal GemFire Region could be found for a given cache name, or the Pivotal GemFire Region
for the given cache name has been destroyed.Cacheprotected GemfireCache newGemfireCache(org.apache.geode.cache.Region<?,?> region)
GemfireCache initialized with the given Pivotal GemFire Region.region - Pivotal GemFire Region to wrap (adapt).GemfireCache initialized with the given Pivotal GemFire Region.GemfireCache,
Regionprotected Cache getMissingCache(String name)
Cache for the given name.
To return a missing Spring Cache for the given name, dynamic cache lookup/creation must be
enabled, which means that either the cacheNames or regions properties must not be set.
If either property was specified then dynamic Spring Cache lookup/creation will be disabled and this
overridden AbstractCacheManager.getMissingCache(String) method will return null.getMissingCache in class AbstractCacheManagername - name of the missing Spring Cache to lookup (and potentially create).Cache instance for the given name or null if the Cache
cannot be found (or possibly created).AbstractCacheManager.getMissingCache(String),
Cacheprotected boolean isDynamic()
CacheManager allows the dynamic creation of a Cache at runtime.Cache creation is enabled.public void setCache(org.apache.geode.cache.GemFireCache gemfireCache)
CacheManager.
When set, if neither Regions nor cacheNames were specified, then this CacheManager
is capable of creating Spring Caches backed by existing Pivotal GemFire Regions used by
the application at runtime. However, in order to dynamically create Spring Caches a reference to
an open Pivotal GemFire cache instance must be set.gemfireCache - the Pivotal GemFire cache instance used by this CacheManager
to manage Spring Caches.GemFireCacheprotected org.apache.geode.cache.GemFireCache getCache()
GemFireCache instance backing this CacheManager.GemFireCache instance backing this CacheManager.GemFireCachepublic void setCacheNames(Set<String> cacheNames)
Caches that will be used in the application.
When set, this disables the dynamic capability of this CacheManager to create Spring Caches
at runtime by dynamically looking up existing Regions from the Pivotal GemFire cache instance.public void setRegions(Set<org.apache.geode.cache.Region<?,?>> regions)
Regions to be used as Spring Caches
in the application.
When set, this disables the dynamic capability of this CacheManager to create Spring Caches
at runtime by dynamically looking up existing Regions from the Pivotal GemFire cache instance.regions - Set of Pivotal GemFire Regions used by this CacheManager
as Spring Caches.Regionprotected Set<org.apache.geode.cache.Region<?,?>> getRegions()
Regions used explicitly as Spring Caches
in Spring's caching infrastructure.Regions functioning as Spring Caches
in Spring's caching infrastructureRegionCopyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.