3.7.4.1.2. Data Cache

Data Cache examines caching in OpenJPA. Metadata extensions allow individual classes to override system caching defaults.

OpenJPA defines the org.apache.openjpa.persistence.DataCache annotation for caching information. This annotation has the following properties:

  • boolean enabled: Whether to cache data for instances of the class. Defaults to true for base classes, or the superclass value for subclasses. If you set this property to false, all other properties are ignored.

  • int timeout: The number of milliseconds data for the class remains valid. Use -1 for no timeout. Defaults to the openjpa.DataCacheTimeout property value.