Skip navigation links

Package org.hibernate.cache.spi.access

<p> Defines contracts for transactional and concurrent access to cached entity and collection data.

See: Description

Package org.hibernate.cache.spi.access Description

<p> Defines contracts for transactional and concurrent access to cached entity and collection data. Transactions pass in a timestamp indicating transaction start time which is then used to protect against concurrent access (exactly how that occurs is based on the actual access-strategy impl used). Two different implementation patterns are provided for: <ul> <li> A transaction-aware cache implementation might be wrapped by a <i>synchronous</i> access strategy, where updates to the cache are written to the cache inside the transaction. </li> <li> A non-transaction-aware cache would be wrapped by an <i>asynchronous</i> access strategy, where items are merely "soft locked" during the transaction and then updated during the "after transaction completion" phase; the soft lock is not an actual lock on the database row - only upon the cached representation of the item. </li> </ul> The <i>asynchronous</i> access strategies are: read-only, read-write and nonstrict-read-write. The only <i>synchronous</i> access strategy is transactional. </p> <p> Note that, for an <i>asynchronous</i> cache, cache invalidation must be a two step process (lock→unlock or lock→afterUpdate), since this is the only way to guarantee consistency with the database for a nontransactional cache implementation. For a <i>synchronous</i> cache, cache invalidation is a single step process (evict or update). Hence, these contracts (org.hibernate.cache.spi.access.EntityRegionAccessStrategy and org.hibernate.cache.spi.access.CollectionRegionAccessStrategy) define a three step process to cater for both models (see the individual contracts for details). </p> <p> Note that query result caching does not go through an access strategy; those caches are managed directly against the underlying QueryResultsRegion. </p>

Skip navigation links

Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.