Gemfire JavaDocs
Interface GemFireCache
-
- All Superinterfaces:
java.lang.AutoCloseable
,RegionService
- All Known Subinterfaces:
Cache
,ClientCache
public interface GemFireCache extends RegionService
GemFireCache represents the singleton cache that must be created in order to use GemFire in a Java virtual machine. Users must create either aCache
for a peer/server JVM or aClientCache
for a client JVM. Instances of this interface are created using one of the following methods:CacheFactory.create()
creates a peer/server instance ofCache
.ClientCacheFactory.create()
creates a client instance ofClientCache
.
- Since:
- GemFire 6.5
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DiskStoreFactory
createDiskStoreFactory()
create diskstore factoryGatewaySenderFactory
createGatewaySenderFactory()
DiskStore
findDiskStore(java.lang.String name)
Returns the DiskStore by name ornull
if no disk store is found.CacheTransactionManager
getCacheTransactionManager()
Get the CacheTransactionManager instance for this Cache.boolean
getCopyOnRead()
Indicates whether the "copy on read" is enabled for this cache.DistributedSystem
getDistributedSystem()
Returns the distributed system used by this cache.Declarable
getInitializer()
Returns the Declarable used to initialize this cache ornull
if it does not have an initializer.java.util.Properties
getInitializerProps()
Returns the Properties used to initialize the cache initializer ornull
if no initializer properties exist.javax.naming.Context
getJNDIContext()
Returns the JNDI context associated with the Cache.LogWriter
getLogger()
Gets the logging object for GemFire.java.lang.String
getName()
Returns the name of this cache.java.lang.String
getPdxDiskStore()
Returns the disk store used for PDX meta databoolean
getPdxIgnoreUnreadFields()
Returns true if fields that are not read during PDX deserialization should be ignored during the PDX serialization.boolean
getPdxPersistent()
Returns true if the PDX metadata for this cache is persistentboolean
getPdxReadSerialized()
Returns whetherPdxInstance
is preferred for PDX types instead of Java object.PdxSerializer
getPdxSerializer()
Returns the PdxSerializer used by this cache, or null if no PDX serializer is defined.<K,V>
RegionAttributes<K,V>getRegionAttributes(java.lang.String id)
Returns theRegionAttributes
with the givenid
ornull
if noRegionAttributes
with that id exists.ResourceManager
getResourceManager()
Returns theResourceManager
for managing this cache's resources.LogWriter
getSecurityLogger()
Gets the security logging object for GemFire.<K,V>
java.util.Map<java.lang.String,RegionAttributes<K,V>>listRegionAttributes()
Returns an unmodifiable mapping of ids to region attributes.void
loadCacheXml(java.io.InputStream is)
Loads the cache configuration described in a declarative caching XML file into this cache.void
registerPdxMetaData(java.lang.Object instance)
Registers PDX meta-data given an instance of a domain class that will be serialized with PDX.void
setCopyOnRead(boolean copyOnRead)
Sets the "copy on read" feature for cache read operations.<K,V>
voidsetRegionAttributes(java.lang.String id, RegionAttributes<K,V> attrs)
Sets theid
of the givenRegionAttributes
.-
Methods inherited from interface org.apache.geode.cache.RegionService
close, createPdxEnum, createPdxInstanceFactory, getCancelCriterion, getJsonDocumentFactory, getJsonDocumentFactory, getJsonFormatter, getQueryService, getRegion, isClosed, rootRegions
-
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the name of this cache. This method does not throwCacheClosedException
if the cache is closed.- Returns:
- the String name of this cache
-
getDistributedSystem
DistributedSystem getDistributedSystem()
Returns the distributed system used by this cache. This method does not throwCacheClosedException
if the cache is closed.- Returns:
- the distributed system used by this cache
-
getResourceManager
ResourceManager getResourceManager()
Returns theResourceManager
for managing this cache's resources.- Returns:
ResourceManager
for managing this cache's resources- Since:
- GemFire 6.0
-
setCopyOnRead
void setCopyOnRead(boolean copyOnRead)
Sets the "copy on read" feature for cache read operations.- Parameters:
copyOnRead
- whether the "copy on read" feature should be enabled- Since:
- GemFire 4.0
-
getCopyOnRead
boolean getCopyOnRead()
Indicates whether the "copy on read" is enabled for this cache.- Returns:
- true if "copy on read" is enabled, false otherwise.
- Since:
- GemFire 4.0
-
getRegionAttributes
<K,V> RegionAttributes<K,V> getRegionAttributes(java.lang.String id)
Returns theRegionAttributes
with the givenid
ornull
if noRegionAttributes
with that id exists.- Type Parameters:
K
- the type of keys in the regionV
- the type of values in the region- Parameters:
id
- theid
of theRegionAttributes
- Returns:
- the
RegionAttributes
with the givenid
- Since:
- GemFire 4.1
- See Also:
setRegionAttributes(java.lang.String, org.apache.geode.cache.RegionAttributes<K, V>)
-
setRegionAttributes
<K,V> void setRegionAttributes(java.lang.String id, RegionAttributes<K,V> attrs)
Sets theid
of the givenRegionAttributes
. If a region attributes namedname
already exists, the mapping will be overwritten withattrs
. However, changing the mapping will not effect existing regions.- Type Parameters:
K
- the type of keys in the regionV
- the type of values in the region- Parameters:
id
- The id of the region attributesattrs
- The attributes to associate withid
. Ifattrs
isnull
, any existingRegionAttributes
associated withid
will be removed.- Since:
- GemFire 4.1
- See Also:
getRegionAttributes(java.lang.String)
-
listRegionAttributes
<K,V> java.util.Map<java.lang.String,RegionAttributes<K,V>> listRegionAttributes()
Returns an unmodifiable mapping of ids to region attributes. The keys of the map areString
s and the values of the map areRegionAttributes
.- Type Parameters:
K
- the type of keys in the regionV
- the type of values in the region- Returns:
- an unmodifiable mapping of ids to region attributes
- Since:
- GemFire 4.1
-
loadCacheXml
void loadCacheXml(java.io.InputStream is) throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException
Loads the cache configuration described in a declarative caching XML file into this cache. If the XML describes a region that already exists, any mutable region attributes, indexes, and region entries that are defined in the XML are updated/added.Because this method may perform a
put
on aRegion
, it declares that it throws aTimeoutException
,CacheWriterException
,GatewayException
, orRegionExistsException
.- Parameters:
is
- the InputStream from which to read the XML- Throws:
CacheXmlException
- If the XML read fromis
does not conform to the dtd or if anIOException
occurs while reading the XML.TimeoutException
CacheWriterException
GatewayException
RegionExistsException
- Since:
- GemFire 4.1
-
getLogger
LogWriter getLogger()
Gets the logging object for GemFire. This method does not throwCacheClosedException
if the cache is closed.- Returns:
- the logging object
-
getSecurityLogger
LogWriter getSecurityLogger()
Gets the security logging object for GemFire. This method does not throwCacheClosedException
if the cache is closed.- Returns:
- the security logging object
-
findDiskStore
DiskStore findDiskStore(java.lang.String name)
Returns the DiskStore by name ornull
if no disk store is found.- Parameters:
name
- the name of the disk store to find. Ifnull
then the default disk store, if it exists, is returned.- Returns:
- the DiskStore by name or
null
if no disk store is found - Since:
- GemFire 6.5
-
createDiskStoreFactory
DiskStoreFactory createDiskStoreFactory()
create diskstore factory- Returns:
- a
DiskStoreFactory
- Since:
- GemFire 6.5
-
createGatewaySenderFactory
GatewaySenderFactory createGatewaySenderFactory()
-
getPdxReadSerialized
boolean getPdxReadSerialized()
Returns whetherPdxInstance
is preferred for PDX types instead of Java object.- Returns:
- whether
PdxInstance
is preferred for PDX types instead of Java object - Since:
- GemFire 6.6
- See Also:
CacheFactory.setPdxReadSerialized(boolean)
,ClientCacheFactory.setPdxReadSerialized(boolean)
-
getPdxSerializer
PdxSerializer getPdxSerializer()
Returns the PdxSerializer used by this cache, or null if no PDX serializer is defined.- Returns:
- the PdxSerializer used by this cache, or null if no PDX serializer is defined
- Since:
- GemFire 6.6
- See Also:
CacheFactory.setPdxSerializer(PdxSerializer)
,ClientCacheFactory.setPdxSerializer(PdxSerializer)
-
getPdxDiskStore
java.lang.String getPdxDiskStore()
Returns the disk store used for PDX meta data- Returns:
- the disk store used for PDX meta data
- Since:
- GemFire 6.6
- See Also:
CacheFactory.setPdxDiskStore(String)
,ClientCacheFactory.setPdxDiskStore(String)
-
getPdxPersistent
boolean getPdxPersistent()
Returns true if the PDX metadata for this cache is persistent- Returns:
- whether the PDX metadata for this cache is persistent
- Since:
- GemFire 6.6
- See Also:
CacheFactory.setPdxPersistent(boolean)
,ClientCacheFactory.setPdxPersistent(boolean)
-
getPdxIgnoreUnreadFields
boolean getPdxIgnoreUnreadFields()
Returns true if fields that are not read during PDX deserialization should be ignored during the PDX serialization.- Returns:
- whether fields that are not read during PDX deserialization should be ignored during the PDX serialization
- Since:
- GemFire 6.6
- See Also:
CacheFactory.setPdxIgnoreUnreadFields(boolean)
,ClientCacheFactory.setPdxIgnoreUnreadFields(boolean)
-
registerPdxMetaData
void registerPdxMetaData(java.lang.Object instance)
Registers PDX meta-data given an instance of a domain class that will be serialized with PDX.Note that this method serializes the given instance so PDX must already be configured to do the serialization.
Note that if the instance is not of a class that will be serialized with PDX then no meta-data is registered.
Note that in most cases this method never needs to be called. Currently it is only needed by the JdbcLoader when gets are done for JDBC data that was not written to the table using geode.
- Parameters:
instance
- the instance of the domain class for which meta-data is to be registered- Throws:
SerializationException
- if the instance can not be serialized or is not serialized with PDX- Since:
- Geode 1.6
-
getCacheTransactionManager
CacheTransactionManager getCacheTransactionManager()
Get the CacheTransactionManager instance for this Cache.- Returns:
- The CacheTransactionManager instance.
- Throws:
CacheClosedException
- if the cache is closed.- Since:
- GemFire 4.0
-
getJNDIContext
javax.naming.Context getJNDIContext()
Returns the JNDI context associated with the Cache.- Returns:
- javax.naming.Context Added as part of providing JTA implementation in Gemfire.
- Since:
- GemFire 4.0
-
getInitializer
Declarable getInitializer()
Returns the Declarable used to initialize this cache ornull
if it does not have an initializer.- Returns:
- the Declarable used to initialize this cache
- Since:
- GemFire 6.6
-
getInitializerProps
java.util.Properties getInitializerProps()
Returns the Properties used to initialize the cache initializer ornull
if no initializer properties exist.- Returns:
- the Properties used to initialize the cache initializer
- Since:
- GemFire 6.6
-
-