Package org.wildfly.security.cache
Class LRURealmIdentityCache
java.lang.Object
org.wildfly.security.cache.LRURealmIdentityCache
- All Implemented Interfaces:
RealmIdentityCache
A
RealmIdentityCache implementation providing a LRU cache.- Author:
- Pedro Igor
-
Constructor Summary
ConstructorsConstructorDescriptionLRURealmIdentityCache(int maxEntries) Creates a new instance.LRURealmIdentityCache(int maxEntries, long maxAge) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all cached identities from this cache.Obtains a previously cachedRealmIdentityornullif no entry could be found with the specifiedPrincipal.voidput(Principal key, RealmIdentity newValue) Puts a newRealmIdentityinto the cache and referenced by the specifiedPrincipal.voidRemoves a specific cached identity from the cache and referenced by the specifiedPrincipal.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.security.cache.RealmIdentityCache
computeIfAbsent
-
Constructor Details
-
LRURealmIdentityCache
public LRURealmIdentityCache(int maxEntries) Creates a new instance.- Parameters:
maxEntries- the maximum number of entries to keep in the cache
-
LRURealmIdentityCache
public LRURealmIdentityCache(int maxEntries, long maxAge) Creates a new instance.- Parameters:
maxEntries- the maximum number of entries to keep in the cachemaxAge- the time in milliseconds that an entry can stay in the cache. If-1, entries never expire
-
-
Method Details
-
put
Description copied from interface:RealmIdentityCachePuts a newRealmIdentityinto the cache and referenced by the specifiedPrincipal.- Specified by:
putin interfaceRealmIdentityCache- Parameters:
key- thePrincipalthat references the realm identity being cachednewValue- theRealmIdentityinstance
-
get
Description copied from interface:RealmIdentityCacheObtains a previously cachedRealmIdentityornullif no entry could be found with the specifiedPrincipal.- Specified by:
getin interfaceRealmIdentityCache- Parameters:
key- thePrincipalthat references a previously cached realm identity- Returns:
- a cached
RealmIdentityinstance ornullif no entry could be found with the specifiedprincipal.
-
remove
Description copied from interface:RealmIdentityCacheRemoves a specific cached identity from the cache and referenced by the specifiedPrincipal.- Specified by:
removein interfaceRealmIdentityCache- Parameters:
key- thePrincipalthat references a previously cached realm identity
-
clear
public void clear()Description copied from interface:RealmIdentityCacheRemoves all cached identities from this cache.- Specified by:
clearin interfaceRealmIdentityCache
-