Class MetaStoreCacheInvalidator
- All Implemented Interfaces:
PostDeleteEventListener,PostInsertEventListener,PostUpdateEventListener
MetaStore JSON-field caches once per transaction that changes a
cache-affecting entity.
When a transaction flushes its first cache-affecting entity, a single AfterTransactionCompletionProcess is registered and the remaining rows are deduplicated via
PENDING. This avoids invalidating the (possibly distributed) cache for every row. This
follows Hibernate's own CollectionCacheInvalidator, which
registers its after-completion process from flush-time post events.
Changes to JSON fields and JSON models are only reflected by MetaStore once the
transaction completes. A transaction that changes them and reads them back before committing may
get the previously cached state.
The cache is invalidated on both commit and rollback: the cache loaders run on the caller's session, so a cache miss during a transaction with flushed changes may have cached uncommitted state.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonPostDelete(PostDeleteEvent event) voidonPostInsert(PostInsertEvent event) voidonPostUpdate(PostUpdateEvent event) booleanrequiresPostCommitHandling(EntityPersister persister)
-
Constructor Details
-
MetaStoreCacheInvalidator
public MetaStoreCacheInvalidator()
-
-
Method Details
-
onPostInsert
- Specified by:
onPostInsertin interfacePostInsertEventListener
-
onPostUpdate
- Specified by:
onPostUpdatein interfacePostUpdateEventListener
-
onPostDelete
- Specified by:
onPostDeletein interfacePostDeleteEventListener
-
requiresPostCommitHandling
-