public interface Cache extends GemFireCache
CacheFactory.create()
method.
See CacheFactory
for common usage patterns for creating the cache instance.
When a cache is created a DistributedSystem
is also created.
This system tells the cache where to find other caches on the network
and how to communicate with them.
The system can also specify a
"cache-xml-file"
property which will cause this cache to be initialized with the contents
of that file. The contents must comply with the
"doc-files/cache8_0.dtd"
file
and the top level element must be a cache
element.
When a cache will no longer be used it should be closed
.
Once it is closed
any attempt to use it or any Region
obtained from it will cause a CacheClosedException
to be thrown.
A cache can have multiple root regions, each with a different name.
Modifier and Type | Method and Description |
---|---|
BridgeServer |
addBridgeServer()
Deprecated.
as of 5.7 use
addCacheServer() instead. |
CacheServer |
addCacheServer()
Creates a new cache server, with the default configuration,
that will allow clients to access this cache.
|
GatewayHub |
addGatewayHub(String id,
int port)
Deprecated.
as of GemFire 8.0. Use
GatewaySenderFactory.create(String, int) and GatewayReceiverFactory.create() instead |
void |
close(boolean keepalive)
Deprecated.
as of 6.5 use
ClientCache.close(boolean) instead. |
AsyncEventQueueFactory |
createAsyncEventQueueFactory()
Creates
AsyncEventQueueFactory for creating a
AsyncEventQueue |
GatewayReceiverFactory |
createGatewayReceiverFactory()
Creates
GatewayReceiverFactory for creating a GatewayReceiver |
GatewaySenderFactory |
createGatewaySenderFactory()
Creates
GatewaySenderFactory for creating a
SerialGatewaySender |
<K,V> Region<K,V> |
createRegion(String name,
RegionAttributes<K,V> aRegionAttributes)
Deprecated.
as of 6.5 use
createRegionFactory(RegionAttributes) instead |
<K,V> RegionFactory<K,V> |
createRegionFactory()
Creates a
RegionFactory which can be used to specify additional
attributes for Region creation. |
<K,V> RegionFactory<K,V> |
createRegionFactory(RegionAttributes<K,V> regionAttributes)
Creates a
RegionFactory for creating a Region from
the given regionAttributes |
<K,V> RegionFactory<K,V> |
createRegionFactory(RegionShortcut atts)
|
<K,V> RegionFactory<K,V> |
createRegionFactory(String regionAttributesId)
Creates a
RegionFactory for creating a Region from
RegionAttributes mapped to this regionAttributesId |
<K,V> Region<K,V> |
createVMRegion(String name,
RegionAttributes<K,V> aRegionAttributes)
Deprecated.
as of GemFire 5.0, use
createRegion(java.lang.String, com.gemstone.gemfire.cache.RegionAttributes<K, V>) instead. |
Set<DistributedMember> |
getAdminMembers()
Returns a set of the administrative members in the distributed system.
|
AsyncEventQueue |
getAsyncEventQueue(String id)
Returns the
AsyncEventQueue with the given id added to this Cache. |
Set<AsyncEventQueue> |
getAsyncEventQueues()
Returns all
AsyncEventQueue s for this Cache |
List<CacheServer> |
getBridgeServers()
Deprecated.
as of 5.7 use
getCacheServers() instead. |
List<CacheServer> |
getCacheServers()
Returns a collection of all of the
CacheServer s
that can serve the contents of this Cache to clients. |
GatewayConflictResolver |
getGatewayConflictResolver()
Returns the current gateway event conflict resolver
|
GatewayHub |
getGatewayHub()
Deprecated.
as of GemFire 5.1, use
getGatewayHubs() .get(0) instead. |
GatewayHub |
getGatewayHub(String id)
Deprecated.
as of Gemfire 8.0. use
getGatewaySender(String) instead. |
List<GatewayHub> |
getGatewayHubs()
Deprecated.
as of Gemfire 8.0. use
getGatewaySenders() , use getGatewayReceivers() instead. |
Set<GatewayReceiver> |
getGatewayReceivers()
Returns all
GatewayReceiver s for this Cache |
GatewaySender |
getGatewaySender(String id)
Returns the
GatewaySender with the given id added to this Cache. |
Set<GatewaySender> |
getGatewaySenders()
Returns all
GatewaySender s for this Cache. |
int |
getLockLease()
Gets the length, in seconds, of distributed lock leases obtained
by this cache.
|
int |
getLockTimeout()
Gets the number of seconds a cache operation will wait to obtain
a distributed lock lease.
|
LogWriterI18n |
getLoggerI18n()
Deprecated.
as of 6.5 use getLogger().convertToLogWriterI18n() instead
|
Set<DistributedMember> |
getMembers()
Returns a set of the other non-administrative members in the distributed system.
|
Set<DistributedMember> |
getMembers(Region r)
Returns a set of the members in the distributed system that have the
given region.
|
int |
getMessageSyncInterval()
Gets the frequency (in seconds) at which a message will be sent by the
primary cache-server to all the secondary cache-server nodes to remove the
events which have already been dispatched from the queue.
|
Cache |
getReconnectedCache()
Returns the new Cache if there was an auto-reconnect and the cache was
recreated.
|
int |
getSearchTimeout()
Gets the number of seconds a cache
get operation
can spend searching for a value before it times out. |
LogWriterI18n |
getSecurityLoggerI18n()
Deprecated.
as of 6.5 use getSecurityLogger().convertToLogWriterI18n() instead
|
CacheSnapshotService |
getSnapshotService()
Obtains the snapshot service to allow the cache data to be imported
or exported.
|
boolean |
isReconnecting()
Test to see whether the Cache is in the process of reconnecting
and recreating a new cache after it has been removed from the system
by other members or has shut down due to missing Roles and is reconnecting.
|
boolean |
isServer()
Returns whether or not this cache resides in a "cache server" VM.
|
void |
readyForEvents()
Deprecated.
as of 6.5 use
ClientCache.readyForEvents() instead. |
void |
setGatewayConflictResolver(GatewayConflictResolver resolver)
Adds a gateway event conflict resolution resolver.
|
GatewayHub |
setGatewayHub(String id,
int port)
Deprecated.
as of GemFire 5.1, use
addGatewayHub(java.lang.String, int) instead. |
void |
setIsServer(boolean isServer)
Sets whether or not this
Cache resides in a
long-running "cache server" VM. |
void |
setLockLease(int seconds)
Sets the length, in seconds, of distributed lock leases obtained
by this cache.
|
void |
setLockTimeout(int seconds)
Sets the number of seconds a cache operation may wait to obtain a
distributed lock lease before timing out.
|
void |
setMessageSyncInterval(int seconds)
Sets the frequency (in seconds) at which a message will be sent by the
primary cache-server node to all the secondary cache-server nodes to remove
the events which have already been dispatched from the queue.
|
void |
setSearchTimeout(int seconds)
Sets the number of seconds a cache get operation can spend searching
for a value.
|
void |
stopReconnecting()
Force the Cache to stop reconnecting.
|
boolean |
waitUntilReconnected(long time,
TimeUnit units)
Wait for the Cache to finish reconnecting to the distributed system
and recreate a new Cache.
|
createDiskStoreFactory, findDiskStore, getCacheTransactionManager, getCopyOnRead, getDistributedSystem, getInitializer, getInitializerProps, getJNDIContext, getLogger, getName, getPdxDiskStore, getPdxIgnoreUnreadFields, getPdxPersistent, getPdxReadSerialized, getPdxSerializer, getRegionAttributes, getResourceManager, getSecurityLogger, listRegionAttributes, loadCacheXml, setCopyOnRead, setRegionAttributes
close, createPdxEnum, createPdxInstanceFactory, getCancelCriterion, getQueryService, getRegion, isClosed, rootRegions
@Deprecated void close(boolean keepalive)
ClientCache.close(boolean)
instead.Region.close()
on each region in the cache.
After this cache is closed, any further
method call on this cache or any region object will throw
CacheClosedException
, unless otherwise noted.keepalive
- whether the server should keep the durable client's queues alive for the timeout periodCacheClosedException
- if the cache is already closed.@Deprecated <K,V> Region<K,V> createVMRegion(String name, RegionAttributes<K,V> aRegionAttributes) throws RegionExistsException, TimeoutException
createRegion(java.lang.String, com.gemstone.gemfire.cache.RegionAttributes<K, V>)
instead.name
- the name of the region to createaRegionAttributes
- the attributes of the root regionRegionExistsException
- if a region is already in
this cacheLeaseExpiredException
- if lease expired on distributed lock for Scope.GLOBALTimeoutException
- if timed out getting distributed lock for Scope.GLOBALCacheClosedException
- if the cache is closedIllegalStateException
- If the supplied RegionAttributes violate the
region creation constraints
with a region of the same name in another cache in the distributed system@Deprecated <K,V> Region<K,V> createRegion(String name, RegionAttributes<K,V> aRegionAttributes) throws RegionExistsException, TimeoutException
createRegionFactory(RegionAttributes)
insteadname
- the name of the region to createaRegionAttributes
- the attributes of the root regionRegionExistsException
- if a region is already in this cacheLeaseExpiredException
- if lease expired on distributed lock for Scope.GLOBALTimeoutException
- if timed out getting distributed lock for Scope.GLOBALCacheClosedException
- if the cache is closedIllegalStateException
- If the supplied RegionAttributes violate the
region creation constraints
with a region of the same name in another cache in the distributed system<K,V> RegionFactory<K,V> createRegionFactory()
RegionFactory
which can be used to specify additional
attributes for Region
creation.createRegionFactory(RegionShortcut)
<K,V> RegionFactory<K,V> createRegionFactory(RegionShortcut atts)
<K,V> RegionFactory<K,V> createRegionFactory(String regionAttributesId)
RegionFactory
for creating a Region
from
RegionAttributes
mapped to this regionAttributesIdregionAttributesId
- the Id of RegionAttributes to be usedGemFireCache.setRegionAttributes(String, RegionAttributes)
<K,V> RegionFactory<K,V> createRegionFactory(RegionAttributes<K,V> regionAttributes)
RegionFactory
for creating a Region
from
the given regionAttributesregionAttributes
- regionAttributes for the new regioncreateRegionFactory(RegionShortcut)
@Deprecated LogWriterI18n getLoggerI18n()
GemFireCache.getLogger()
instead.
This method does not throw
CacheClosedException
if the cache is closed.@Deprecated LogWriterI18n getSecurityLoggerI18n()
GemFireCache.getSecurityLogger()
instead.
This method does not throw
CacheClosedException
if the cache is closed.int getLockTimeout()
CacheClosedException
if the cache is closed.void setLockTimeout(int seconds)
IllegalArgumentException
- if seconds
is less than zeroint getMessageSyncInterval()
void setMessageSyncInterval(int seconds)
seconds
- -
the time interval in secondsIllegalArgumentException
- if seconds
is less than zeroint getLockLease()
CacheClosedException
if the cache is closed.void setLockLease(int seconds)
IllegalArgumentException
- if seconds
is less than zero.int getSearchTimeout()
get
operation
can spend searching for a value before it times out.
The search includes any time spent loading the object.
When the search times out it causes the get to fail by throwing
an exception.
This method does not throw
CacheClosedException
if the cache is closed.void setSearchTimeout(int seconds)
IllegalArgumentException
- if seconds
is less than zero@Deprecated BridgeServer addBridgeServer()
addCacheServer()
instead.BridgeLoader
,
BridgeWriter
CacheServer addCacheServer()
For the default configuration see the constants in
CacheServer
.
com.gemstone.gemfire.cache.server
@Deprecated List<CacheServer> getBridgeServers()
getCacheServers()
instead.BridgeServer
s
that can serve the contents of this Cache
.
Since 5.7
this method returns a List
Collection.
addBridgeServer()
List<CacheServer> getCacheServers()
CacheServer
s
that can serve the contents of this Cache
to clients.addCacheServer()
@Deprecated GatewayHub setGatewayHub(String id, int port)
addGatewayHub(java.lang.String, int)
instead.GatewayHub
with the default configuration.id
- The id of the GatewayHub
port
- The port of the GatewayHub
Gateway
@Deprecated GatewayHub addGatewayHub(String id, int port)
GatewaySenderFactory.create(String, int)
and GatewayReceiverFactory.create()
insteadGatewayHub
with the default configuration
and adds it to the collection of GatewayHub
s.id
- The id of the GatewayHub
port
- The port of the GatewayHub
Gateway
@Deprecated GatewayHub getGatewayHub()
getGatewayHubs()
.get(0) instead.GatewayHub
.Gateway
@Deprecated List<GatewayHub> getGatewayHubs()
GatewayHub
s.addGatewayHub(java.lang.String, int)
@Deprecated GatewayHub getGatewayHub(String id)
getGatewaySender(String)
instead.GatewayHub
with the given id.id
- The id of the GatewayHub
addGatewayHub(java.lang.String, int)
void setGatewayConflictResolver(GatewayConflictResolver resolver)
resolver
- GatewayConflictResolver getGatewayConflictResolver()
void setIsServer(boolean isServer)
Cache
resides in a
long-running "cache server" VM. A cache server may be an
application VM or may be a stand-along VM launched using administration API or the cacheserver
command line
utility.boolean isServer()
setIsServer(boolean)
@Deprecated void readyForEvents()
ClientCache.readyForEvents()
instead.
Durable clients must call this method after they are done creating regions.
If it is called before the client creates the regions then updates will be lost.
Any time a new Pool
is created and regions have been added to it then
this method needs to be called again.
IllegalStateException
- if called by a non-durable clientGatewaySenderFactory createGatewaySenderFactory()
GatewaySenderFactory
for creating a
SerialGatewaySendercreateGatewaySenderFactory
in interface GemFireCache
AsyncEventQueueFactory createAsyncEventQueueFactory()
AsyncEventQueueFactory
for creating a
AsyncEventQueueGatewayReceiverFactory createGatewayReceiverFactory()
GatewayReceiverFactory
for creating a GatewayReceiverSet<GatewaySender> getGatewaySenders()
GatewaySender
s for this Cache.GatewaySender getGatewaySender(String id)
GatewaySender
with the given id added to this Cache.Set<GatewayReceiver> getGatewayReceivers()
GatewayReceiver
s for this CacheSet<AsyncEventQueue> getAsyncEventQueues()
AsyncEventQueue
s for this CacheAsyncEventQueue getAsyncEventQueue(String id)
AsyncEventQueue
with the given id added to this Cache.Set<DistributedMember> getMembers()
Set<DistributedMember> getAdminMembers()
Set<DistributedMember> getMembers(Region r)
r
- a Region in the cacheCacheSnapshotService getSnapshotService()
boolean isReconnecting()
This will also return true if the Cache has finished reconnecting.
When reconnect has completed you can use getReconnectedCache()
to
retrieve the new cache instance.
boolean waitUntilReconnected(long time, TimeUnit units) throws InterruptedException
time
- amount of time to wait, or -1 to wait foreverunits
- InterruptedException
- if the thread is interrupted while waitinggetReconnectedCache()
void stopReconnecting()
Cache getReconnectedCache()
Copyright © 1997-2017 Pivotal Software, Inc. All rights reserved.