The event should also support user invalidation events

Closes #33777

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
This commit is contained in:
Pedro Igor
2024-10-10 13:17:12 -03:00
committed by GitHub
parent beb26fd584
commit d822154758

View File

@@ -23,9 +23,10 @@ import org.infinispan.protostream.annotations.ProtoFactory;
import org.infinispan.protostream.annotations.ProtoTypeId;
import org.keycloak.marshalling.Marshalling;
import org.keycloak.models.cache.infinispan.RealmCacheManager;
import org.keycloak.models.cache.infinispan.UserCacheManager;
@ProtoTypeId(Marshalling.CACHE_KEY_INVALIDATION_EVENT)
public class CacheKeyInvalidatedEvent extends InvalidationEvent implements RealmCacheInvalidationEvent {
public class CacheKeyInvalidatedEvent extends InvalidationEvent implements RealmCacheInvalidationEvent, UserCacheInvalidationEvent {
@ProtoFactory
public CacheKeyInvalidatedEvent(String id) {
@@ -36,4 +37,9 @@ public class CacheKeyInvalidatedEvent extends InvalidationEvent implements Realm
public void addInvalidations(RealmCacheManager realmCache, Set<String> invalidations) {
realmCache.invalidateCacheKey(getId(), invalidations);
}
@Override
public void addInvalidations(UserCacheManager userCache, Set<String> invalidations) {
userCache.invalidateCacheKey(getId(), invalidations);
}
}