blob: 5a76cdc7e17aa22cb226c9727f13e127874402a8 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>CachingRealm (Apache Shiro 1.9.1 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CachingRealm (Apache Shiro 1.9.1 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav"><!-- Matomo --> <script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ /* We explicitly disable cookie tracking to avoid privacy issues */ _paq.push(['disableCookies']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//matomo.privacy.apache.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '2']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Matomo Code -->
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/CachingRealm.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.shiro.realm</a></div>
<h2 title="Class CachingRealm" class="title">Class CachingRealm</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.shiro.realm.CachingRealm</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="../authc/LogoutAware.html" title="interface in org.apache.shiro.authc">LogoutAware</a></code>, <code><a href="../cache/CacheManagerAware.html" title="interface in org.apache.shiro.cache">CacheManagerAware</a></code>, <code><a href="Realm.html" title="interface in org.apache.shiro.realm">Realm</a></code>, <code><a href="../util/Nameable.html" title="interface in org.apache.shiro.util">Nameable</a></code></dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><code><a href="AuthenticatingRealm.html" title="class in org.apache.shiro.realm">AuthenticatingRealm</a></code></dd>
</dl>
<hr>
<pre>public abstract class <a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.48">CachingRealm</a>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>
implements <a href="Realm.html" title="interface in org.apache.shiro.realm">Realm</a>, <a href="../util/Nameable.html" title="interface in org.apache.shiro.util">Nameable</a>, <a href="../cache/CacheManagerAware.html" title="interface in org.apache.shiro.cache">CacheManagerAware</a>, <a href="../authc/LogoutAware.html" title="interface in org.apache.shiro.authc">LogoutAware</a></pre>
<div class="block">A very basic abstract extension point for the <a href="Realm.html" title="interface in org.apache.shiro.realm"><code>Realm</code></a> interface that provides caching support for subclasses.
<p/>
It also provides a convenience method,
<a href="#getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)"><code>getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)</code></a>, which is useful across all
realm subclasses for obtaining a realm-specific principal/identity.
<p/>
All actual Realm method implementations are left to subclasses.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>0.9</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#clearCache(org.apache.shiro.subject.PrincipalCollection)"><code>clearCache(org.apache.shiro.subject.PrincipalCollection)</code></a>,
<a href="#onLogout(org.apache.shiro.subject.PrincipalCollection)"><code>onLogout(org.apache.shiro.subject.PrincipalCollection)</code></a>,
<a href="#getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)"><code>getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">CachingRealm</a></span>()</code></th>
<td class="colLast">
<div class="block">Default no-argument constructor that defaults
<a href="#isCachingEnabled()"><code>cachingEnabled</code></a> (for general caching) to <code>true</code> and sets a
default <a href="#getName()"><code>name</code></a> based on the class name.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#afterCacheManagerSet()">afterCacheManagerSet</a></span>()</code></th>
<td class="colLast">
<div class="block">Template method that may be implemented by subclasses should they wish to react to a
<a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> instance being set on the realm instance via the
<a href="#setCacheManager(org.apache.shiro.cache.CacheManager)"><code>setCacheManager(org.apache.shiro.cache.CacheManager)</code></a> mutator.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#clearCache(org.apache.shiro.subject.PrincipalCollection)">clearCache</a></span>&#8203;(<a href="../subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</code></th>
<td class="colLast">
<div class="block">Clears out any cached data associated with the specified account identity/identities.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#doClearCache(org.apache.shiro.subject.PrincipalCollection)">doClearCache</a></span>&#8203;(<a href="../subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</code></th>
<td class="colLast">
<div class="block">This implementation does nothing - it is a template to be overridden by subclasses if necessary.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)">getAvailablePrincipal</a></span>&#8203;(<a href="../subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</code></th>
<td class="colLast">
<div class="block">A utility method for subclasses that returns the first available principal of interest to this particular realm.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getCacheManager()">getCacheManager</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the <tt>CacheManager</tt> used for data caching to reduce EIS round trips, or <tt>null</tt> if
caching is disabled.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getName()">getName</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the (application-unique) name assigned to this <code>Realm</code>.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isCachingEnabled()">isCachingEnabled</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns <code>true</code> if caching should be used if a <a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> has been
<a href="#setCacheManager(org.apache.shiro.cache.CacheManager)"><code>configured</code></a>, <code>false</code> otherwise.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onLogout(org.apache.shiro.subject.PrincipalCollection)">onLogout</a></span>&#8203;(<a href="../subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</code></th>
<td class="colLast">
<div class="block">If caching is enabled, this will clear any cached data associated with the specified account identity.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setCacheManager(org.apache.shiro.cache.CacheManager)">setCacheManager</a></span>&#8203;(<a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</a>&nbsp;cacheManager)</code></th>
<td class="colLast">
<div class="block">Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setCachingEnabled(boolean)">setCachingEnabled</a></span>&#8203;(boolean&nbsp;cachingEnabled)</code></th>
<td class="colLast">
<div class="block">Sets whether or not caching should be used if a <a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> has been
<a href="#setCacheManager(org.apache.shiro.cache.CacheManager)"><code>configured</code></a>.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setName(java.lang.String)">setName</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Sets the (preferably application unique) name for this component.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.org.apache.shiro.realm.Realm">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;org.apache.shiro.realm.<a href="Realm.html" title="interface in org.apache.shiro.realm">Realm</a></h3>
<code><a href="Realm.html#getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken)">getAuthenticationInfo</a>, <a href="Realm.html#supports(org.apache.shiro.authc.AuthenticationToken)">supports</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>CachingRealm</h4>
<pre>public&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.71">CachingRealm</a>()</pre>
<div class="block">Default no-argument constructor that defaults
<a href="#isCachingEnabled()"><code>cachingEnabled</code></a> (for general caching) to <code>true</code> and sets a
default <a href="#getName()"><code>name</code></a> based on the class name.
<p/>
Note that while in general, caching may be enabled by default, subclasses have control over
if specific caching is enabled.</div>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="getCacheManager()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCacheManager</h4>
<pre class="methodSignature">public&nbsp;<a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</a>&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.83">getCacheManager</a>()</pre>
<div class="block">Returns the <tt>CacheManager</tt> used for data caching to reduce EIS round trips, or <tt>null</tt> if
caching is disabled.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the <tt>CacheManager</tt> used for data caching to reduce EIS round trips, or <tt>null</tt> if
caching is disabled.</dd>
</dl>
</li>
</ul>
<a id="setCacheManager(org.apache.shiro.cache.CacheManager)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setCacheManager</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.94">setCacheManager</a>&#8203;(<a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</a>&nbsp;cacheManager)</pre>
<div class="block">Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips.
<p/>
This property is <tt>null</tt> by default, indicating that caching is turned off.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../cache/CacheManagerAware.html#setCacheManager(org.apache.shiro.cache.CacheManager)">setCacheManager</a></code>&nbsp;in interface&nbsp;<code><a href="../cache/CacheManagerAware.html" title="interface in org.apache.shiro.cache">CacheManagerAware</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cacheManager</code> - the <tt>CacheManager</tt> to use for data caching, or <tt>null</tt> to disable caching.</dd>
</dl>
</li>
</ul>
<a id="isCachingEnabled()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isCachingEnabled</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.110">isCachingEnabled</a>()</pre>
<div class="block">Returns <code>true</code> if caching should be used if a <a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> has been
<a href="#setCacheManager(org.apache.shiro.cache.CacheManager)"><code>configured</code></a>, <code>false</code> otherwise.
<p/>
The default value is <code>true</code> since the large majority of Realms will benefit from caching if a CacheManager
has been configured. However, memory-only realms should set this value to <code>false</code> since they would
manage account data in memory already lookups would already be as efficient as possible.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if caching will be globally enabled if a <a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> has been
configured, <code>false</code> otherwise</dd>
</dl>
</li>
</ul>
<a id="setCachingEnabled(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setCachingEnabled</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.120">setCachingEnabled</a>&#8203;(boolean&nbsp;cachingEnabled)</pre>
<div class="block">Sets whether or not caching should be used if a <a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> has been
<a href="#setCacheManager(org.apache.shiro.cache.CacheManager)"><code>configured</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cachingEnabled</code> - whether or not to globally enable caching for this realm.</dd>
</dl>
</li>
</ul>
<a id="getName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getName</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.124">getName</a>()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="Realm.html#getName()">Realm</a></code></span></div>
<div class="block">Returns the (application-unique) name assigned to this <code>Realm</code>. All realms configured for a single
application must have a unique name.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="Realm.html#getName()">getName</a></code>&nbsp;in interface&nbsp;<code><a href="Realm.html" title="interface in org.apache.shiro.realm">Realm</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the (application-unique) name assigned to this <code>Realm</code>.</dd>
</dl>
</li>
</ul>
<a id="setName(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setName</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.128">setName</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;name)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="../util/Nameable.html#setName(java.lang.String)">Nameable</a></code></span></div>
<div class="block">Sets the (preferably application unique) name for this component.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../util/Nameable.html#setName(java.lang.String)">setName</a></code>&nbsp;in interface&nbsp;<code><a href="../util/Nameable.html" title="interface in org.apache.shiro.util">Nameable</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the preferably application unique name for this component.</dd>
</dl>
</li>
</ul>
<a id="afterCacheManagerSet()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>afterCacheManagerSet</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.137">afterCacheManagerSet</a>()</pre>
<div class="block">Template method that may be implemented by subclasses should they wish to react to a
<a href="../cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> instance being set on the realm instance via the
<a href="#setCacheManager(org.apache.shiro.cache.CacheManager)"><code>setCacheManager(org.apache.shiro.cache.CacheManager)</code></a> mutator.</div>
</li>
</ul>
<a id="onLogout(org.apache.shiro.subject.PrincipalCollection)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onLogout</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.151">onLogout</a>&#8203;(<a href="../subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</pre>
<div class="block">If caching is enabled, this will clear any cached data associated with the specified account identity.
Subclasses are free to override for additional behavior, but be sure to call <code>super.onLogout</code> first.
<p/>
This default implementation merely calls <a href="#clearCache(org.apache.shiro.subject.PrincipalCollection)"><code>clearCache(org.apache.shiro.subject.PrincipalCollection)</code></a>.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../authc/LogoutAware.html#onLogout(org.apache.shiro.subject.PrincipalCollection)">onLogout</a></code>&nbsp;in interface&nbsp;<code><a href="../authc/LogoutAware.html" title="interface in org.apache.shiro.authc">LogoutAware</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>principals</code> - the application-specific Subject/user identifier that is logging out.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.2</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#clearCache(org.apache.shiro.subject.PrincipalCollection)"><code>clearCache(org.apache.shiro.subject.PrincipalCollection)</code></a>,
<a href="#getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)"><code>getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)</code></a></dd>
</dl>
</li>
</ul>
<a id="clearCache(org.apache.shiro.subject.PrincipalCollection)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clearCache</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.168">clearCache</a>&#8203;(<a href="../subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</pre>
<div class="block">Clears out any cached data associated with the specified account identity/identities.
<p/>
This implementation will return quietly if the principals argument is null or empty. Otherwise it delegates
to <a href="#doClearCache(org.apache.shiro.subject.PrincipalCollection)"><code>doClearCache(org.apache.shiro.subject.PrincipalCollection)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>principals</code> - the principals of the account for which to clear any cached data.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.2</dd>
</dl>
</li>
</ul>
<a id="doClearCache(org.apache.shiro.subject.PrincipalCollection)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>doClearCache</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.181">doClearCache</a>&#8203;(<a href="../subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</pre>
<div class="block">This implementation does nothing - it is a template to be overridden by subclasses if necessary.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>principals</code> - principals the principals of the account for which to clear any cached data.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.2</dd>
</dl>
</li>
</ul>
<a id="getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getAvailablePrincipal</h4>
<pre class="methodSignature">protected&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.202">getAvailablePrincipal</a>&#8203;(<a href="../subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</pre>
<div class="block">A utility method for subclasses that returns the first available principal of interest to this particular realm.
The heuristic used to acquire the principal is as follows:
<ul>
<li>Attempt to get <em>this particular Realm's</em> 'primary' principal in the <code>PrincipalCollection</code> via a
<code>principals.<a href="../subject/PrincipalCollection.html#fromRealm(java.lang.String)"><code>fromRealm</code></a>(<a href="#getName()"><code>getName()</code></a>)</code>
call.</li>
<li>If the previous call does not result in any principals, attempt to get the overall 'primary' principal
from the PrincipalCollection via <a href="../subject/PrincipalCollection.html#getPrimaryPrincipal()"><code>PrincipalCollection.getPrimaryPrincipal()</code></a>.</li>
<li>If there are no principals from that call (or the PrincipalCollection argument was null to begin with),
return <code>null</code></li>
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>principals</code> - the PrincipalCollection holding all principals (from all realms) associated with a single Subject.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the 'primary' principal attributed to this particular realm, or the fallback 'master' principal if it
exists, or if not <code>null</code>.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.2</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/CachingRealm.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 2004&#x2013;2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>