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:
-
Cache
CacheFactory
GemFireCache
RegionService
ClientCache
ClientCacheFactory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SimpleCacheResolver
Lazily constructs and gets an instance to theSimpleCacheResolver
, as needed.<T extends org.apache.geode.cache.GemFireCache>
Trequire()
Requires an instance of either aClientCache
or a peerCache
.<T extends org.apache.geode.cache.GemFireCache>
Optional<T>resolve()
The resolution algorithm first tries to resolve anOptional
ClientCache
instance then a peerCache
instance if aClientCache
is not present.Optional<org.apache.geode.cache.client.ClientCache>
Attempts to resolve anOptional
ClientCache
instance.Optional<org.apache.geode.cache.Cache>
Attempts to resolve anOptional
Cache
instance.
-
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 anOptional
ClientCache
instance then a peerCache
instance if aClientCache
is not present. If neither aClientCache
or peerCache
is available, thenOptional.empty()
is returned. NoException
is thrown.- Type Parameters:
T
-subclass
ofGemFireCache
.- Returns:
- a
ClientCache
or then a peerCache
instance if present. - See Also:
-
ClientCache
Cache
Optional
resolveClientCache()
resolvePeerCache()
-
resolveClientCache
Attempts to resolve anOptional
ClientCache
instance.- Returns:
- an
Optional
ClientCache
instance. - See Also:
-
CacheUtils.isClientCache(RegionService)
ClientCacheFactory.getAnyInstance()
ClientCache
Optional
-
resolvePeerCache
Attempts to resolve anOptional
Cache
instance.- Returns:
- an
Optional
Cache
instance. - See Also:
-
CacheUtils.isPeerCache(RegionService)
CacheFactory.getAnyInstance()
Cache
Optional
-
require
public <T extends org.apache.geode.cache.GemFireCache> T require()Requires an instance of either aClientCache
or a peerCache
.- Type Parameters:
T
-subclass
ofGemFireCache
to resolve.- Returns:
- an instance of either a
ClientCache
or a peerCache
. - Throws:
IllegalStateException
- if a cache instance cannot be resolved.- See Also:
-
ClientCache
Cache
GemFireCache
resolve()
-