Spring Boot for VMware GemFire
Package org.springframework.geode.cache
Class SimpleCacheResolver
java.lang.Object
org.springframework.geode.cache.SimpleCacheResolver
The
SimpleCacheResolver abstract class contains utility functions for resolving Apache Geode
GemFireCache instances, such as a ClientCache or a peer Cache.- Since:
- 1.3.0
- See Also:
-
CacheCacheFactoryGemFireCacheRegionServiceClientCacheClientCacheFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SimpleCacheResolverLazily constructs and gets an instance to theSimpleCacheResolver, as needed.<T extends org.apache.geode.cache.GemFireCache>
Trequire()Requires an instance of either aClientCacheor a peerCache.<T extends org.apache.geode.cache.GemFireCache>
Optional<T>resolve()The resolution algorithm first tries to resolve anOptionalClientCacheinstance then a peerCacheinstance if aClientCacheis not present.Optional<org.apache.geode.cache.client.ClientCache>Attempts to resolve anOptionalClientCacheinstance.Optional<org.apache.geode.cache.Cache>Attempts to resolve anOptionalCacheinstance.
-
Constructor Details
-
SimpleCacheResolver
public SimpleCacheResolver()
-
-
Method Details
-
getInstance
Lazily constructs and gets an instance to theSimpleCacheResolver, as needed.- Returns:
- an instance of the
SimpleCacheResolver. - See Also:
-
newSimpleCacheResolver()
-
resolve
The resolution algorithm first tries to resolve anOptionalClientCacheinstance then a peerCacheinstance if aClientCacheis not present. If neither aClientCacheor peerCacheis available, thenOptional.empty()is returned. NoExceptionis thrown.- Type Parameters:
T-subclassofGemFireCache.- Returns:
- a
ClientCacheor then a peerCacheinstance if present. - See Also:
-
ClientCacheCacheOptionalresolveClientCache()resolvePeerCache()
-
resolveClientCache
Attempts to resolve anOptionalClientCacheinstance.- Returns:
- an
OptionalClientCacheinstance. - See Also:
-
CacheUtils.isClientCache(RegionService)ClientCacheFactory.getAnyInstance()ClientCacheOptional
-
resolvePeerCache
Attempts to resolve anOptionalCacheinstance.- Returns:
- an
OptionalCacheinstance. - See Also:
-
CacheUtils.isPeerCache(RegionService)CacheFactory.getAnyInstance()CacheOptional
-
require
public <T extends org.apache.geode.cache.GemFireCache> T require()Requires an instance of either aClientCacheor a peerCache.- Type Parameters:
T-subclassofGemFireCacheto resolve.- Returns:
- an instance of either a
ClientCacheor a peerCache. - Throws:
IllegalStateException- if a cache instance cannot be resolved.- See Also:
-
ClientCacheCacheGemFireCacheresolve()
-