Interface GemFireCache

All Superinterfaces:
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 a Cache for a peer/server JVM or a ClientCache for a client JVM. Instances of this interface are created using one of the following methods:
Since:
GemFire 6.5
  • Method Details

    • getName

      String getName()
      Returns the name of this cache. This method does not throw CacheClosedException 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 throw CacheClosedException if the cache is closed.
      Returns:
      the distributed system used by this cache
    • getResourceManager

      ResourceManager getResourceManager()
      Returns the ResourceManager 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(String id)
      Returns the RegionAttributes with the given id or null if no RegionAttributes with that id exists.
      Type Parameters:
      K - the type of keys in the region
      V - the type of values in the region
      Parameters:
      id - the id of the RegionAttributes
      Returns:
      the RegionAttributes with the given id
      Since:
      GemFire 4.1
      See Also:
    • setRegionAttributes

      <K, V> void setRegionAttributes(String id, RegionAttributes<K,V> attrs)
      Sets the id of the given RegionAttributes. If a region attributes named name already exists, the mapping will be overwritten with attrs. However, changing the mapping will not effect existing regions.
      Type Parameters:
      K - the type of keys in the region
      V - the type of values in the region
      Parameters:
      id - The id of the region attributes
      attrs - The attributes to associate with id. If attrs is null, any existing RegionAttributes associated with id will be removed.
      Since:
      GemFire 4.1
      See Also:
    • listRegionAttributes

      <K, V> Map<String,RegionAttributes<K,V>> listRegionAttributes()
      Returns an unmodifiable mapping of ids to region attributes. The keys of the map are Strings and the values of the map are RegionAttributes.
      Type Parameters:
      K - the type of keys in the region
      V - the type of values in the region
      Returns:
      an unmodifiable mapping of ids to region attributes
      Since:
      GemFire 4.1
    • loadCacheXml

      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 a Region, it declares that it throws a TimeoutException, CacheWriterException, GatewayException, or RegionExistsException.

      Parameters:
      is - the InputStream from which to read the XML
      Throws:
      CacheXmlException - If the XML read from is does not conform to the dtd or if an IOException 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 throw CacheClosedException if the cache is closed.
      Returns:
      the logging object
    • getSecurityLogger

      LogWriter getSecurityLogger()
      Gets the security logging object for GemFire. This method does not throw CacheClosedException if the cache is closed.
      Returns:
      the security logging object
    • findDiskStore

      DiskStore findDiskStore(String name)
      Returns the DiskStore by name or null if no disk store is found.
      Parameters:
      name - the name of the disk store to find. If null 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 whether PdxInstance 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:
    • 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:
    • getPdxDiskStore

      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:
    • 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:
    • 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:
    • registerPdxMetaData

      void registerPdxMetaData(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

      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 or null if it does not have an initializer.
      Returns:
      the Declarable used to initialize this cache
      Since:
      GemFire 6.6
    • getInitializerProps

      Properties getInitializerProps()
      Returns the Properties used to initialize the cache initializer or null if no initializer properties exist.
      Returns:
      the Properties used to initialize the cache initializer
      Since:
      GemFire 6.6