Package org.wildfly.security.cache
Interface RealmIdentityCache
-
- All Known Implementing Classes:
LRURealmIdentityCache
public interface RealmIdentityCacheProvides a mechanism to plug a cache for
RealmIdentityinstances obtained from aSecurityRealm.Implementors should be aware that
RealmIdentityinstances may require serialization depending on the implementation in use, as well any state within those instances such as attributes.- Author:
- Pedro Igor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclear()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.RealmIdentityget(Principal principal)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.voidremove(Principal principal)Removes a specific cached identity from the cache and referenced by the specifiedPrincipal.
-
-
-
Method Detail
-
put
void put(Principal principal, RealmIdentity realmIdentity)
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
RealmIdentity get(Principal principal)
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
void remove(Principal principal)
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.
-
-