Region Shortcuts

GemFire provides predefined, shortcut region attributes settings for your use, in RegionShortcut.

Shortcut attributes are a convenience only. They are 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.

You can also create 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 named attributes by providing the ID to the region creation. This example uses the shortcut CACHING_PROXY attributes to create a region:

<region name="testRegion" refid="CACHING_PROXY"/>

You can modify named attributes as needed. For example, this adds a cache listener to the region:

<region name="testRegion" refid="CACHING_PROXY">
    <region-attributes>
        <cache-listener library-name="myAppLib"
            library-function-name ="myCacheListener" />
    </region-attributes>
</region>

In this example, the modified region shortcut is saved to the cache using the region attribute id, for retrieval and use by a second region:

<region name="testRegion" refid="CACHING_PROXY">
    <region-attributes id="Caching_Proxy_With_Listener">
        <cache-listener library-name="myAppLib"
            library-function-name ="myCacheListener" />
    </region-attributes>
</region>
<region name="newTestRegion" refid="Caching_Proxy_With_Listener"/>

Shortcut Attribute Options

You can select the most common region attributes settings from RegionShortcut, the predefined named region attributes.

This section provides an overview of the options available in the region shortcut settings.

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.
  • 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.

Data Eviction

Non-PROXY regions are those that store data in the client cache. You can add data eviction for non-PROXY regions:

  • ENTRY_LRU causes least recently used data to be evicted from memory when the region reaches the entry count limit.