Defining data cache settings for a bean

Lifetime in cache settings can provide a way for you to improve performance for beans that are only occasionally updated.

Lifetime in cache usage settings are 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.

To define data cache settings (this option is only available to 2.x CMP entity beans):

  1. Switch to the J2EE perspective.
  2. In the Project Explorer view, select the desired EJB module.
  3. Right-click on the Deployment Descriptor Editor and select Open With from the pop-up menu.
  4. On the Beans page of the editor, go to the Data Cache section.
  5. 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.
  6. 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.
For additional information on data cache settings, see the WebSphere Application Server documentation.

Feedback