Use object cache instances
Perform this task so that the application can access dynamic cache object cache instances with the DistributedMap or DistributedObjectCache interfaces.
Before beginning, enable the dynamic cache service.
Using object cache instances can improve the performance of the application because we can programmatically store and share frequently used objects. By using object cache instances, we also have control over the dynamic cache when we are running multiple applications in an application server.
- Configure one or more cache instances.
- In the 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. We can mix scopes, if necessary.
We 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 JNDI name for this cache instance.
This is name passed to the InitialContext lookup() method from within the application. For example...
services/cache/instance_one
- Enter or modify other properties as needed.
- Update the application.
To store and retrieve objects in an object cache instance, we need a DistributedMap or DistributedObjectCache reference for the named object cache instance.
Results
You configured object cache instances that we can access programmatically with the DistributedMap and DistributedObjectCache interfaces.
What to do next
See Additional APIs for more information about the DistributedMap or DistributedObjectCache interfaces.
Related concepts
Cache instancesUse the DistributedMap and DistributedObjectCache interfaces for the dynamic cache