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 10:48:39 -03:00
parent 9a3d81c23e
commit f4f3a7de4a

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);
}
}