Package org.wildfly.security.cache
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 Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all cached identities from this cache.default RealmIdentitycomputeIfAbsent(Principal principal, Function<Principal, RealmIdentity> mappingFunction) If the specified key is not already associated with a value (or is mapped tonull), attempts to compute its value using the given mapping function and enters it into this map unlessnull.Obtains a previously cachedRealmIdentityornullif no entry could be found with the specifiedPrincipal.voidput(Principal principal, RealmIdentity realmIdentity) Puts a newRealmIdentityinto the cache and referenced by the specifiedPrincipal.voidRemoves a specific cached identity from the cache and referenced by the specifiedPrincipal.
-
Method Details
-
put
Puts a newRealmIdentityinto the cache and referenced by the specifiedPrincipal.- Parameters:
principal- thePrincipalthat references the realm identity being cachedrealmIdentity- theRealmIdentityinstance
-
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 unlessnull.If the function returns
nullno mapping is recorded. If the function itself throws an (unchecked) exception, the exception is rethrown, and no mapping is recorded.- Parameters:
principal- thePrincipalthat references the realm identity being cachedmappingFunction- the function that produces theRealmIdentityto cache ornull- Returns:
- a cached
RealmIdentityinstance
-
get
Obtains a previously cachedRealmIdentityornullif no entry could be found with the specifiedPrincipal.- Parameters:
principal- thePrincipalthat references a previously cached realm identity- Returns:
- a cached
RealmIdentityinstance ornullif no entry could be found with the specifiedprincipal.
-
remove
Removes a specific cached identity from the cache and referenced by the specifiedPrincipal.- Parameters:
principal- thePrincipalthat references a previously cached realm identity
-
clear
void clear()Removes all cached identities from this cache.
-