Perform this task so that your application can access dynamic
cache object cache instances with the DistributedMap or DistributedObjectCache
interfaces.
About this task
Using object cache instances can improve the performance
of your application because you can programmatically store and share
frequently used objects. By using object cache instances, you also
have the necessary control over the dynamic cache when you are running
multiple applications in an application server. See Cache instances for more information.
Procedure
- Configure one or more cache instances.
- In the administrative console, click Resources >
Cache instances > Object cache instances.
- Specify the scope for the cache instance.
Cell scope makes
the cache instance available to all servers within the cell. Node
scope makes the cache instance available to all servers on the particular
node. Cluster scope makes the cache instance available to all members
in a specified cluster. Server scope makes the cache instance available
to only the selected server. You can mix scopes, if necessary.
WebSphere Application Server Express® has the node
and server scopes, which you can mix.
Note: You cannot create cache instances
(object or servlet) at different scopes with the same cache name or
JNDI name.
- Click Apply after changing the
scope.
- Click New.
- Enter the Java™ Naming
and Directory Interface (JNDI) name for this cache instance.
This
is name that you pass to the InitialContext lookup() method from within
your application. For example, services/cache/instance_one
.
- Enter or modify other properties as needed.
- Update your application.
Results
You configured object cache instances that you can access
programmatically with the DistributedMap and DistributedObjectCache
interfaces.
What to do next
See Programming Interfaces (APIs) for
more information about the DistributedMap or DistributedObjectCache
interfaces.