Interface RealmIdentityCache

  • All Known Implementing Classes:
    LRURealmIdentityCache

    public interface RealmIdentityCache

    Provides a mechanism to plug a cache for RealmIdentity instances obtained from a SecurityRealm.

    Implementors should be aware that RealmIdentity instances may require serialization depending on the implementation in use, as well any state within those instances such as attributes.

    Author:
    Pedro Igor
    • Method Detail

      • computeIfAbsent

        default RealmIdentity computeIfAbsent​(Principal principal,
                                              Function<Principal,​RealmIdentity> mappingFunction)

        If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.

        If the function returns null no mapping is recorded. If the function itself throws an (unchecked) exception, the exception is rethrown, and no mapping is recorded.

        Parameters:
        principal - the Principal that references the realm identity being cached
        mappingFunction - the function that produces the RealmIdentity to cache or null
        Returns:
        a cached RealmIdentity instance
      • get

        RealmIdentity get​(Principal principal)
        Obtains a previously cached RealmIdentity or null if no entry could be found with the specified Principal.
        Parameters:
        principal - the Principal that references a previously cached realm identity
        Returns:
        a cached RealmIdentity instance or null if no entry could be found with the specified principal.
      • remove

        void remove​(Principal principal)
        Removes a specific cached identity from the cache and referenced by the specified Principal.
        Parameters:
        principal - the Principal that references a previously cached realm identity
      • clear

        void clear()
        Removes all cached identities from this cache.