blob: 455de5099b1f58ac57772a216ad0cbf16954c8d1 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="fr">
<head>
<!-- Generated by javadoc (1.8.0_77) on Sun May 14 11:51:27 CEST 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CachingRealm (Apache Shiro 1.4.0 API)</title>
<meta name="date" content="2017-05-14">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CachingRealm (Apache Shiro 1.4.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"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";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.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">
<li><a href="../../../../org/apache/shiro/realm/AuthorizingRealm.html" title="class in org.apache.shiro.realm"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/shiro/realm/CachingRealm.html" target="_top">Frames</a></li>
<li><a href="CachingRealm.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></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>
</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 name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.shiro.realm</div>
<h2 title="Class CachingRealm" class="title">Class CachingRealm</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">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><a href="../../../../org/apache/shiro/authc/LogoutAware.html" title="interface in org.apache.shiro.authc">LogoutAware</a>, <a href="../../../../org/apache/shiro/cache/CacheManagerAware.html" title="interface in org.apache.shiro.cache">CacheManagerAware</a>, <a href="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm">Realm</a>, <a href="../../../../org/apache/shiro/util/Nameable.html" title="interface in org.apache.shiro.util">Nameable</a></dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../../../org/apache/shiro/realm/AuthenticatingRealm.html" title="class in org.apache.shiro.realm">AuthenticatingRealm</a></dd>
</dl>
<hr>
<br>
<pre>public abstract class <a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.48">CachingRealm</a>
extends <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>
implements <a href="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm">Realm</a>, <a href="../../../../org/apache/shiro/util/Nameable.html" title="interface in org.apache.shiro.util">Nameable</a>, <a href="../../../../org/apache/shiro/cache/CacheManagerAware.html" title="interface in org.apache.shiro.cache">CacheManagerAware</a>, <a href="../../../../org/apache/shiro/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="../../../../org/apache/shiro/realm/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="../../../../org/apache/shiro/realm/CachingRealm.html#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="../../../../org/apache/shiro/realm/CachingRealm.html#clearCache-org.apache.shiro.subject.PrincipalCollection-"><code>clearCache(org.apache.shiro.subject.PrincipalCollection)</code></a>,
<a href="../../../../org/apache/shiro/realm/CachingRealm.html#onLogout-org.apache.shiro.subject.PrincipalCollection-"><code>onLogout(org.apache.shiro.subject.PrincipalCollection)</code></a>,
<a href="../../../../org/apache/shiro/realm/CachingRealm.html#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 ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#CachingRealm--">CachingRealm</a></span>()</code>
<div class="block">Default no-argument constructor that defaults
<a href="../../../../org/apache/shiro/realm/CachingRealm.html#isCachingEnabled--"><code>cachingEnabled</code></a> (for general caching) to <code>true</code> and sets a
default <a href="../../../../org/apache/shiro/realm/CachingRealm.html#getName--"><code>name</code></a> based on the class name.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<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="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#afterCacheManagerSet--">afterCacheManagerSet</a></span>()</code>
<div class="block">Template method that may be implemented by subclasses should they wish to react to a
<a href="../../../../org/apache/shiro/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="../../../../org/apache/shiro/realm/CachingRealm.html#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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#clearCache-org.apache.shiro.subject.PrincipalCollection-">clearCache</a></span>(<a href="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</code>
<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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#doClearCache-org.apache.shiro.subject.PrincipalCollection-">doClearCache</a></span>(<a href="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</code>
<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="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#getAvailablePrincipal-org.apache.shiro.subject.PrincipalCollection-">getAvailablePrincipal</a></span>(<a href="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</code>
<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="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#getCacheManager--">getCacheManager</a></span>()</code>
<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="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#getName--">getName</a></span>()</code>
<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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#isCachingEnabled--">isCachingEnabled</a></span>()</code>
<div class="block">Returns <code>true</code> if caching should be used if a <a href="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> has been
<a href="../../../../org/apache/shiro/realm/CachingRealm.html#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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#onLogout-org.apache.shiro.subject.PrincipalCollection-">onLogout</a></span>(<a href="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</a>&nbsp;principals)</code>
<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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#setCacheManager-org.apache.shiro.cache.CacheManager-">setCacheManager</a></span>(<a href="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache">CacheManager</a>&nbsp;cacheManager)</code>
<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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#setCachingEnabled-boolean-">setCachingEnabled</a></span>(boolean&nbsp;cachingEnabled)</code>
<div class="block">Sets whether or not caching should be used if a <a href="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> has been
<a href="../../../../org/apache/shiro/realm/CachingRealm.html#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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/shiro/realm/CachingRealm.html#setName-java.lang.String-">setName</a></span>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">Sets the (preferably application unique) name for this component.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.shiro.realm.Realm">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;org.apache.shiro.realm.<a href="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm">Realm</a></h3>
<code><a href="../../../../org/apache/shiro/realm/Realm.html#getAuthenticationInfo-org.apache.shiro.authc.AuthenticationToken-">getAuthenticationInfo</a>, <a href="../../../../org/apache/shiro/realm/Realm.html#supports-org.apache.shiro.authc.AuthenticationToken-">supports</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="CachingRealm--">
<!-- -->
</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="../../../../org/apache/shiro/realm/CachingRealm.html#isCachingEnabled--"><code>cachingEnabled</code></a> (for general caching) to <code>true</code> and sets a
default <a href="../../../../org/apache/shiro/realm/CachingRealm.html#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>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getCacheManager--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCacheManager</h4>
<pre>public&nbsp;<a href="../../../../org/apache/shiro/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 name="setCacheManager-org.apache.shiro.cache.CacheManager-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setCacheManager</h4>
<pre>public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.94">setCacheManager</a>(<a href="../../../../org/apache/shiro/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="../../../../org/apache/shiro/cache/CacheManagerAware.html#setCacheManager-org.apache.shiro.cache.CacheManager-">setCacheManager</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../org/apache/shiro/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 name="isCachingEnabled--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isCachingEnabled</h4>
<pre>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="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> has been
<a href="../../../../org/apache/shiro/realm/CachingRealm.html#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="../../../../org/apache/shiro/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 name="setCachingEnabled-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setCachingEnabled</h4>
<pre>public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.120">setCachingEnabled</a>(boolean&nbsp;cachingEnabled)</pre>
<div class="block">Sets whether or not caching should be used if a <a href="../../../../org/apache/shiro/cache/CacheManager.html" title="interface in org.apache.shiro.cache"><code>CacheManager</code></a> has been
<a href="../../../../org/apache/shiro/realm/CachingRealm.html#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 name="getName--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getName</h4>
<pre>public&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">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="../../../../org/apache/shiro/realm/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="../../../../org/apache/shiro/realm/Realm.html#getName--">getName</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../org/apache/shiro/realm/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 name="setName-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setName</h4>
<pre>public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.128">setName</a>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="../../../../org/apache/shiro/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="../../../../org/apache/shiro/util/Nameable.html#setName-java.lang.String-">setName</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../org/apache/shiro/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 name="afterCacheManagerSet--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>afterCacheManagerSet</h4>
<pre>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="../../../../org/apache/shiro/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="../../../../org/apache/shiro/realm/CachingRealm.html#setCacheManager-org.apache.shiro.cache.CacheManager-"><code>setCacheManager(org.apache.shiro.cache.CacheManager)</code></a> mutator.</div>
</li>
</ul>
<a name="onLogout-org.apache.shiro.subject.PrincipalCollection-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onLogout</h4>
<pre>public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.151">onLogout</a>(<a href="../../../../org/apache/shiro/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="../../../../org/apache/shiro/realm/CachingRealm.html#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="../../../../org/apache/shiro/authc/LogoutAware.html#onLogout-org.apache.shiro.subject.PrincipalCollection-">onLogout</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../org/apache/shiro/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="../../../../org/apache/shiro/realm/CachingRealm.html#clearCache-org.apache.shiro.subject.PrincipalCollection-"><code>clearCache(org.apache.shiro.subject.PrincipalCollection)</code></a>,
<a href="../../../../org/apache/shiro/realm/CachingRealm.html#getAvailablePrincipal-org.apache.shiro.subject.PrincipalCollection-"><code>getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)</code></a></dd>
</dl>
</li>
</ul>
<a name="clearCache-org.apache.shiro.subject.PrincipalCollection-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clearCache</h4>
<pre>protected&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.168">clearCache</a>(<a href="../../../../org/apache/shiro/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="../../../../org/apache/shiro/realm/CachingRealm.html#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 name="doClearCache-org.apache.shiro.subject.PrincipalCollection-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>doClearCache</h4>
<pre>protected&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.181">doClearCache</a>(<a href="../../../../org/apache/shiro/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 name="getAvailablePrincipal-org.apache.shiro.subject.PrincipalCollection-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getAvailablePrincipal</h4>
<pre>protected&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/CachingRealm.html#line.202">getAvailablePrincipal</a>(<a href="../../../../org/apache/shiro/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="../../../../org/apache/shiro/subject/PrincipalCollection.html#fromRealm-java.lang.String-"><code>fromRealm</code></a>(<a href="../../../../org/apache/shiro/realm/CachingRealm.html#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="../../../../org/apache/shiro/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>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.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">
<li><a href="../../../../org/apache/shiro/realm/AuthorizingRealm.html" title="class in org.apache.shiro.realm"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/shiro/realm/Realm.html" title="interface in org.apache.shiro.realm"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/shiro/realm/CachingRealm.html" target="_top">Frames</a></li>
<li><a href="CachingRealm.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.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>
</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 name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2004&#x2013;2017 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>