[Java programming language only]

Configuring object or servlet dynamic cache instances

WebSphere® Application Server allows you to configure multiple object or servlet dynamic cache instances in addition to the default instance. Use this procedure to configure additional object or servlet cache instances.

Before you begin

About this task

There are two types of cache instances you can create with this procedure, object cache instances and servlet cache instances. An object cache instance is a location in addition to the default shared dynamic cache where Java 2 Platform, Enterprise Edition (J2EE) applications can store, distribute, and share objects. After configuring object cache instances, you can use the DistributedMap or DistributedObjectCache interfaces in the com.ibm.websphere.cache package to programmatically access your cache instances. See the Additional Application Programming Interfaces (APIs) for more information about the DistributedMap or DistributedObjectCache interfaces. Servlet cache instances are locations in addition to the default dynamic cache where dynamic cache can store, distribute, and share the output and the side effects of an invoked servlet. By configuring a servlet cache instance, your applications have greater flexibility and better tuning of cache resources. The Java Naming and Directory Interface (JNDI) name that is specified for the cache instance in the administrative console maps to the cache instance element in the cachespec.xml configuration file. Any <cache-entry> elements that are specified within a <cache-instance> element are created in that specific cache instance. Any <cache-entry> elements that are specified outside of a <cache-instance> element are stored in the default dynamic cache instance. See Cache instances for more information about object and servlet type cache instances.
The steps in this procedure are for Version 8.0 of the WebSphere Application Server administrative console. This information may vary slightly depending on the version of WebSphere Application Server you are using.
Note:
  • WebSphere eXtreme Scale Version 8.6 is not supported on versions of WebSphere Application Server prior to Version 7.0.

Procedure

What to do next

By default, each dynamic cache instance that is configured on WebSphere Application Server corresponds to a dynamic cache data grid that has the same name as the JNDI name of the cache instance. Also, by default, the data for that cache instance is stored in a dynamic map within that dynamic cache data grid, and the suffix for that dynamic map name also corresponds to the JNDI name of the cache instance. For example, if you were to configure a cache instance on WebSphere Application Server with a JNDI name of cache1, then a dynamic cache data grid is created with the name cache1. Inside data grid cache1, a dynamic map named IBM_DC_PARTIONED_cache1 is created to store the data.

In most cases, this configuration does not need to be changed. However, in some circumstances, you might want multiple cache instances, with different JNDI names, to map to different dynamic maps within the same data grid instance. In other circumstances, you might want multiple cache instances, with the same JNDI name, to map to different dynamic cache data grid instances or different dynamic map instances within the same dynamic cache data grid. For example, if you have an application that uses the default dynamic cache instance (baseCache), you might want to use the same data grid for both of your test level and production level environments, while you keep the cached data in separate data grids or separate dynamic maps within the same data grid.

You can set the following custom properties on the cache instances to control this configuration:
Tip: These properties can be especially useful when you use the default dynamic cache instance (baseCache), since the JNDI name for the cache is automatically set to baseCache and cannot be changed.
com.ibm.websphere.xs.dynacache.grid_name
Use this custom property to specify the name of the dynamic cache data grid instance to which a dynamic cache instance corresponds.
com.ibm.websphere.xs.dynacache.cache_name
Use this custom property to specify the name to be used, in place of the JNDI name, for both the dynamic cache data grid name and the dynamic map inside that data grid. If the com.ibm.websphere.xs.dynacache.grid_name custom property is also set, then the value of this property applies only to the dynamic map name.
For information about how to set these properties, see Customizing a dynamic cache instance with custom properties.