Lifetime in cache settings can provide a way for you to
improve performance for beans that are only occasionally updated.
You can use the deployment descriptor editor to define data cache
settings (this option is only available to 2.x CMP entity beans).
About this task
Lifetime in cache usage settings is a WebSphere® Application Server extensions
to the Enterprise JavaBeans 2.x
specification. For more information, see the WebSphere Application Server documentation.
Lifetime in cache settings can provide a way for you to improve performance
for beans that are only occasionally updated.
Procedure
- Switch to the Java™ EE
perspective.
- In the Enterprise Explorer view, select the desired EJB
module.
- Right click the deployment descriptor and select .
- On the Beans page of the editor,
go to the Data Cache section.
- In the Lifetime in cache field,
specify the lifetime, in seconds, of cached data for an instance of
this bean type. This value indicates how long the cached data is to
exist beyond the end of the transaction in which the data was retrieved.
- In the Lifetime in cache usage field,
select one of the following values to indicate how the lifetime-in-cache
setting is to be used by the caching mechanism:
- OFF: When this value is used, the value
of Lifetime in cache is ignored.
- ELAPSED_TIME: When this value is used,
the value of Lifetime in cache is added to
the time at which the transaction in which the bean instance was retrieved
is completed. The resulting value becomes the time at which the cached
data expires.
- CLOCK_TIME: When this value is used,
the value of Lifetime in cache represents a
particular time of day.
- WEEK_TIME: Usage of this value is the
same as for CLOCK_TIME except that the value of Lifetime
in cache can represent more than 24 hours, but not more
than 7 days.
The use of a value other than OFF requires that finders on the
enterprise bean have an access type of Read (wsPessimissticRead or
wsOptimisticRead) because EJB applications are not permitted to update
such CMP beans.
Results
For additional information about data cache settings, see
the WebSphere Application
Server documentation.