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 aSecurityRealm
.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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
clear()
Removes all cached identities from this cache.default RealmIdentity
computeIfAbsent(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
.RealmIdentity
get(Principal principal)
Obtains a previously cachedRealmIdentity
ornull
if no entry could be found with the specifiedPrincipal
.void
put(Principal principal, RealmIdentity realmIdentity)
Puts a newRealmIdentity
into the cache and referenced by the specifiedPrincipal
.void
remove(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 newRealmIdentity
into the cache and referenced by the specifiedPrincipal
.- Parameters:
principal
- thePrincipal
that references the realm identity being cachedrealmIdentity
- theRealmIdentity
instance
-
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
null
no mapping is recorded. If the function itself throws an (unchecked) exception, the exception is rethrown, and no mapping is recorded.- Parameters:
principal
- thePrincipal
that references the realm identity being cachedmappingFunction
- the function that produces theRealmIdentity
to cache ornull
- Returns:
- a cached
RealmIdentity
instance
-
get
RealmIdentity get(Principal principal)
Obtains a previously cachedRealmIdentity
ornull
if no entry could be found with the specifiedPrincipal
.- Parameters:
principal
- thePrincipal
that references a previously cached realm identity- Returns:
- a cached
RealmIdentity
instance ornull
if 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
- thePrincipal
that references a previously cached realm identity
-
clear
void clear()
Removes all cached identities from this cache.
-
-