LATEST VERSION: 9.2.0 - CHANGELOG
Pivotal GemFire® v9.2

Region Shortcuts and Custom Named Region Attributes

GemFire provides region shortcut settings, with preset region configurations for the most common region types. For the easiest configuration, start with a shortcut setting and customize as needed. You can also store your own custom configurations in the cache for use by multiple regions.

You configure automated management of data regions and their entries through region shortcuts and region attributes. These region configuration settings determine such things as where the data resides, how the region is managed in memory, reliability behavior, and the automatic loading, distribution, and expiration of data entries.

Note: Whenever possible, use region shortcuts to configure your region, and further customize behavior using region attributes. The shortcut settings are preset with the most common region configurations.

GemFire provides a number of predefined, shortcut region attributes settings for your use. You can also define your own custom region attributes and store them with an identifier for later retrieval. Both types of stored attributes are referred to as named region attributes. You can create and store your attribute settings in the cache.xml file and through the API.

Retrieve region shortcuts and custom named attributes by providing the ID to the region creation, in the refid attribute setting. This example uses the shortcut REPLICATE attributes to create a region:

<region name="testREP" refid="REPLICATE"/>

You can create your own named attributes as needed, by providing an id in your region attributes declaration. The following region declaration:

  1. Retrieves all of the attribute settings provided by the persistent partitioned region shortcut
  2. Modifies the shortcut attribute settings by specifying a disk store name to use for persistence
  3. Assigns the new attribute settings to the new region named testPR
  4. Stores the attribute settings in a new custom attributes named testPRPersist:

    <disk-store name="testDiskStore" >
        <disk-dirs>
            <disk-dir>PRPersist1</disk-dir>
            <disk-dir>PRPersist2</disk-dir>
        </disk-dirs>
    </disk-store>
    <region name="testPR" >
        <region-attributes id="testPRPersist"
            refid="PARTITION_PERSISTENT" disk-store-name="testDiskStore"/>
    </region>
    

Shortcut Attribute Options

You can select the most common region attributes settings from GemFire’s predefined named region attributes in these classes:

  • org.apache.geode.cache.RegionShortcut. For peers and servers.
  • org.apache.geode.cache.client.ClientRegionShortcut. For clients.

Shortcut attributes are a convenience only. They are just named attributes that GemFire has already stored for you. You can override their settings by storing new attributes with the same id as the predefined attributes.

For a full list of all available region shortcuts, see Region Shortcuts Quick Reference.

The org.apache.geode.cache.RegionShortcut Javadocs give complete listings of the options.

RegionShortcuts for Peers and Servers

These are the primary options available in the region shortcut settings. The names listed appear in the shortcut identifier alone or in combination, like “PARTITION” in PARTITION, PARTITION_PROXY, and PARTITION_REDUNDANT.

Cache Data Storage Mode

  • PARTITION . Creates a partitioned region. This is a data store for the region. You can also specify these options with PARTITION:
    • PROXY. Data is not stored in the local cache and the member is a data accessor to the region. This requires other members to create non-proxy copies of the region, so the data is stored somewhere.
    • REDUNDANT. The region stores a secondary copy of all data, for high availability.
  • REPLICATE. Creates a replicated region. This is a data store for the region. You can also specify these options with REPLICATE:
    • PROXY. Data is not stored in the local cache and the member is a data accessor to the region. This requires other members to create non-proxy copies of the region, so the data is stored somewhere.
  • LOCAL. Creates a region private to the defining member.

Data Eviction

  • HEAP_LRU. Causes least recently used data to be evicted from memory when the GemFire resource manager determines that the cache has reached configured storage limits.

Disk Storage

You can specify these alone or in combination:

  • PERSISTENT. Backs up all data to disk, in addition to storing it in memory.
  • OVERFLOW. Moves data out of memory and on to disk, when memory use becomes too high.

ClientRegionShortcuts for Clients

These are the primary options available in the client region shortcut settings. The names listed appear in the shortcut identifier alone or in combination, like “PROXY” in PROXY and CACHING_PROXY.

Communication with Servers and Data Storage

  • PROXY. Does not store data in the client cache, but connects the region to the servers for data requests and updates, interest registrations, and so on. The client is a data accessor to the region.
  • CACHING_PROXY. Stores data in the client cache and connects the region to the servers for data requests and updates, interest registrations, and so on.
  • LOCAL. Stores data in the client cache and does not connect the region to the servers. This is a client-side-only region. Note that this is not the same as setting the region’s scope attribute to LOCAL.

Data Eviction

  • HEAP_LRU. Causes least recently used data to be evicted from memory when the GemFire resource manager determines that the cache has reached configured storage limits.

Disk Storage

With the LOCAL and CACHING data storage shortcut options, you can also specify these disk storage options, alone or in combination:

  • PERSISTENT. Backs up all data to disk, in addition to storing it in memory.
  • OVERFLOW. Moves data out of memory and on to disk, when memory use becomes too high.