Package org.wildfly.security.cache
Class LRURealmIdentityCache
- java.lang.Object
-
- org.wildfly.security.cache.LRURealmIdentityCache
-
- All Implemented Interfaces:
RealmIdentityCache
public final class LRURealmIdentityCache extends Object implements RealmIdentityCache
ARealmIdentityCacheimplementation providing a LRU cache.- Author:
- Pedro Igor
-
-
Constructor Summary
Constructors Constructor Description LRURealmIdentityCache(int maxEntries)Creates a new instance.LRURealmIdentityCache(int maxEntries, long maxAge)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all cached identities from this cache.RealmIdentityget(Principal key)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.voidremove(Principal key)Removes 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, wait
-
Methods inherited from interface org.wildfly.security.cache.RealmIdentityCache
computeIfAbsent
-
-
-
-
Constructor Detail
-
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 Detail
-
put
public void put(Principal key, RealmIdentity newValue)
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
public RealmIdentity get(Principal key)
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
public void remove(Principal key)
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
-
-