Class RealmCacheManager

java.lang.Object
org.keycloak.models.cache.infinispan.CacheManager
org.keycloak.models.cache.infinispan.RealmCacheManager

public class RealmCacheManager extends CacheManager
Author:
Stian Thorgersen
  • Constructor Details

    • RealmCacheManager

      public RealmCacheManager(org.infinispan.Cache<String,Revisioned> cache, org.infinispan.Cache<String,Long> revisions)
  • Method Details

    • getLogger

      protected org.jboss.logging.Logger getLogger()
      Specified by:
      getLogger in class CacheManager
    • realmUpdated

      public void realmUpdated(String id, String name, Set<String> invalidations)
    • realmRemoval

      public void realmRemoval(String id, String name, Set<String> invalidations)
    • roleAdded

      public void roleAdded(String roleContainerId, Set<String> invalidations)
    • roleUpdated

      public void roleUpdated(String roleContainerId, String roleName, Set<String> invalidations)
    • roleRemoval

      public void roleRemoval(String id, String roleName, String roleContainerId, Set<String> invalidations)
    • clientScopeAdded

      public void clientScopeAdded(String realmId, Set<String> invalidations)
    • clientScopeUpdated

      public void clientScopeUpdated(String realmId, Set<String> invalidations)
    • clientScopeRemoval

      public void clientScopeRemoval(String realmId, Set<String> invalidations)
    • groupQueriesInvalidations

      public void groupQueriesInvalidations(String realmId, Set<String> invalidations)
    • groupNameInvalidations

      public void groupNameInvalidations(String groupId, Set<String> invalidations)
    • clientAdded

      public void clientAdded(String realmId, String clientUUID, String clientId, Set<String> invalidations)
    • clientUpdated

      public void clientUpdated(String realmId, String clientUuid, String clientId, Set<String> invalidations)
    • clientRemoval

      public void clientRemoval(String realmId, String clientUUID, String clientId, Set<String> invalidations)
    • addInvalidationsFromEvent

      protected void addInvalidationsFromEvent(InvalidationEvent event, Set<String> invalidations)
      Specified by:
      addInvalidationsFromEvent in class CacheManager
    • computeSerialized

      public <T> T computeSerialized(KeycloakSession session, String id, BiFunction<String,KeycloakSession,T> compute)
      Compute a cached realm and ensure that this happens only once with the current Keycloak instance. Use this to avoid concurrent preparations of a realm in parallel threads. This helps to break the load on a stampede after a server has started, were a lot of requests come in for the same realm that hasn't been cached yet. Instead of each request loading the realm in parallel, this lets the first request load the realm, and all other requests will use the cached realm, which is much more efficient.