3.11.1.2. Data Cache Usage
The org.apache.openjpa.datacache package defines OpenJPA’s data caching framework.
While you may use this framework directly (see its
Javadoc for details), its APIs are meant primarily for service providers.
In fact, Cache Extension below has tips on how to use this package to extend OpenJPA’s caching service yourself.
Rather than use the low-level org.apache.openjpa.datacache package APIs, JPA users should typically access the data cache through the JPA standard jakarta.persistence.Cache interface, or OpenJPA’s high-level
org.apache.openjpa.persistence.StoreCache facade.
Both interfaces provide methods to evict data from the cache and detect whether an entity is in the cache. The OpenJPA facade adds methods to pin and unpin records, additional methods to evict data, and provides basic statistics of number of read or write requests and hit ratio of the cache.