Skip to content

Commit

Permalink
issue #1042: fixes cache invalidation on collection
Browse files Browse the repository at this point in the history
  • Loading branch information
mrk-vi committed Jul 30, 2024
1 parent c3032ed commit 38a31ad
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.openk9.datasource.actor.ActorSystemProvider;
import io.openk9.datasource.cache.P2PCache;
import io.quarkus.hibernate.orm.PersistenceUnitExtension;
import org.hibernate.CallbackException;
import org.hibernate.EmptyInterceptor;
import org.hibernate.type.Type;
import org.jboss.logging.Logger;
Expand Down Expand Up @@ -82,6 +83,19 @@ public boolean onFlushDirty(
return super.onFlushDirty(entity, id, currentState, previousState, propertyNames, types);
}

@Override
public void onCollectionUpdate(Object collection, Serializable key)
throws CallbackException {

if (log.isTraceEnabled()) {
log.trace("intercepted collectionUpdate");
}

invalidateLocalCache();

super.onCollectionUpdate(collection, key);
}

private void invalidateLocalCache() {
ActorSystem<?> actorSystem = actorSystemProvider.getActorSystem();
P2PCache.askInvalidation(actorSystem);
Expand Down

0 comments on commit 38a31ad

Please sign in to comment.