Home | Sharing policy | 4.2.2 Troubleshooting


4.2.1 Specifying the sharing policy declaration in the cachespec.xml

This sharing policy defines how data is replicated from server to server. By default cache entries are not shared across a cluster. You override that by specifying the sharing policy for each cache entry you want replicated. You also need to configure replication in your environment via the administration console.

Example 4-1 Sample cache-entry showing <sharing-policy> being used

<cache-entry>
<class>servlet</class>
<name>/ConsumerDirect/include/MiniShopCartDisplay.jsp </name>
<property name="save-attributes">false</property>
<property name="store-cookies">false</property>
<property name="save-attributes">false</property>
<property name="do-not-consume">true</property>
<sharing-policy>not-shared</sharing-policy>
<cache-id>
        <timeout>3600</timeout>
            <component  id="storeId" type="parameter">
                <required>true</required>
            </component>
            <component  id="catalogId" type="parameter">
                <required>true</required>
            </component>
            <component  id="DC_userId" type="attribute">
                <required>true</required>
            </component>
 </cache-id>

Table | -1 explains in detail what options you have when setting the value for the <sharing-policy> property. Note that if the <sharing-policy> element is not present, a not-shared value is assumed.

In single server environments, not-shared is the only valid value. When enabling replication, the default value is shared-push only. This property does not affect distribution to Edge Side Include processors through the Edge fragment caching property.

Table 4-1

Value Description
not-shared Cache entries for this object are not shared among different application servers. These entries can contain non-serializable data. For example, a cached servlet can place non-serializable objects into the request attributes, if the <class> type supports it.
shared-push Cache entries for this object are automatically distributed to the DynaCaches in other application servers or cooperating JVMs. Each cache has a copy of the entry at the time it is created. These entries cannot store non-serializable data.
shared-pull1 Cache entries for this object are shared between application servers on demand. If an application server gets a cache miss for this object, it queries the cooperating application servers to see if they have the object. If no application server has a cached copy of the object, the original application server executes the request and generates the object. These entries cannot store non-serializable data. This mode of sharing is not recommended.
shared-push-pull Cache entries for this object are shared between application servers on demand. When an application server generates a cache entry, it broadcasts the cache ID of the created entry to all cooperating application servers. Each server then knows whether an entry exists for any given cache ID. On a given request for that entry, the application server knows whether to generate the entry or pull it from somewhere else. These entries cannot store non-serializable data.

1Shared-pull is not normally recommended, consider shared-push-pull instead.

Sharing policy options

+

Search Tips   |   Advanced Search