本文整理匯總了Java中org.apache.shiro.cache.CacheManager.getCache方法的典型用法代碼示例。如果您正苦於以下問題:Java CacheManager.getCache方法的具體用法?Java CacheManager.getCache怎麽用?Java CacheManager.getCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.shiro.cache.CacheManager
的用法示例。
在下文中一共展示了CacheManager.getCache方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAuthenticationCacheLazy
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
/**
* Checks to see if the authenticationCache class attribute is null, and if so, attempts to acquire one from
* any configured {@link #getCacheManager() cacheManager}. If one is acquired, it is set as the class attribute.
* The class attribute is then returned.
*
* @return an available cache instance to be used for authentication caching or {@code null} if one is not available.
* @since 1.2
*/
private Cache<Object, AuthenticationInfo> getAuthenticationCacheLazy() {
if (this.authenticationCache == null) {
log.trace("No authenticationCache instance set. Checking for a cacheManager...");
CacheManager cacheManager = getCacheManager();
if (cacheManager != null) {
String cacheName = getAuthenticationCacheName();
log.debug("CacheManager [{}] configured. Building authentication cache '{}'", cacheManager, cacheName);
this.authenticationCache = cacheManager.getCache(cacheName);
}
}
return this.authenticationCache;
}
示例2: createActiveSessionsCache
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
protected RedisCache<String, Session> createActiveSessionsCache() {
RedisCache<String, Session> cache = null;
CacheManager mgr = getCacheManager();
if (mgr != null) {
cache = (RedisCache) mgr.getCache(ACTIVE_SESSION_CACHE_NAME);
}
return cache;
}
示例3: getAuthorizationCacheLazy
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
private Cache<Object, AuthorizationInfo> getAuthorizationCacheLazy() {
if (this.authorizationCache == null) {
if (log.isDebugEnabled()) {
log.debug("No authorizationCache instance set. Checking for a cacheManager...");
}
CacheManager cacheManager = getCacheManager();
if (cacheManager != null) {
String cacheName = getAuthorizationCacheName();
if (log.isDebugEnabled()) {
log.debug("CacheManager [" + cacheManager + "] has been configured. Building " +
"authorization cache named [" + cacheName + "]");
}
this.authorizationCache = cacheManager.getCache(cacheName);
} else {
if (log.isDebugEnabled()) {
log.debug("No cache or cacheManager properties have been set. Authorization cache cannot " +
"be obtained.");
}
}
}
return this.authorizationCache;
}
示例4: getAuthorizationCacheLazy
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
/**
* {@inheritDoc} <br />
* Original code from {@link AuthorizingRealm}, copied and modified due to
* dependency of {@link #getAvailableAuthorizationCache()}
*/
private Cache<Object, AuthorizationInfo> getAuthorizationCacheLazy() {
Cache<Object, AuthorizationInfo> authorizationCache = this.getAuthorizationCache();
if ( authorizationCache == null ) {
if ( log.isDebugEnabled() ) {
log.debug( "No authorizationCache instance set. Checking for a cacheManager..." );
}
CacheManager cacheManager = this.getCacheManager();
if ( cacheManager != null ) {
String cacheName = this.getAuthorizationCacheName();
if ( log.isDebugEnabled() ) {
log.debug( "CacheManager [" + cacheManager + "] has been configured. Building " + "authorization cache named [" + cacheName + "]" );
}
authorizationCache = cacheManager.getCache( cacheName );
}
else {
if ( log.isInfoEnabled() ) {
log.info( "No cache or cacheManager properties have been set. Authorization cache cannot " + "be obtained." );
}
}
}
return authorizationCache;
}
示例5: HashedCredentials2Matcher
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
public HashedCredentials2Matcher(CacheManager cacheManager) {
faultPasswordCache = cacheManager.getCache("faultPasswordCache");
}
示例6: setCacheManager
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
public void setCacheManager(CacheManager cacheManager) {
this.cache = cacheManager.getCache("forcedSessionsCache");
}
示例7: RetryLimitHashedCredentialsMatcher
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
public RetryLimitHashedCredentialsMatcher(CacheManager cacheManager) {
passwordRetryCache = cacheManager.getCache("passwordRetryCache");
}
示例8: LimitRetryCredentialsMatcher
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
public LimitRetryCredentialsMatcher(CacheManager cacheManager, RedisManager redisManager) {
this.passwordRetryCache = cacheManager.getCache("passwordRetryCache");
this.redisManager = redisManager;
}
示例9: setCacheManager
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
public void setCacheManager(CacheManager cacheManager) {
this.cache = cacheManager.getCache("shiro-kickout-session");
}
示例10: RetryLimitMatcher
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
public RetryLimitMatcher(CacheManager cacheManager) {
passwordRetryCache = cacheManager.getCache("passwordRetryCache");
maxRetry = 5;
}
示例11: RetryLimitMd5CredentialsMatcher
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
public RetryLimitMd5CredentialsMatcher(CacheManager cacheManager, Integer maxRetryCount) {
passwordRetryCache = cacheManager.getCache("password_retry");
this.maxRetryCount = maxRetryCount;
setHashAlgorithmName(Md5Hash.ALGORITHM_NAME);
}
示例12: RetryLimitHashedCredentialsMatcher
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
public RetryLimitHashedCredentialsMatcher(CacheManager cacheManager) {
passwordRetryCache = cacheManager.getCache("passwordRetryCache");
}
示例13: RetryLimitCredentialsMatcher
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
public RetryLimitCredentialsMatcher(final CacheManager cacheManager) {
Cache<String, AtomicInteger> _cache = cacheManager.<String, AtomicInteger>getCache("passwordRetryCache");
this.passwordRetryCache = _cache;
}
示例14: createActiveSessionsCache
import org.apache.shiro.cache.CacheManager; //導入方法依賴的package包/類
/**
* Creates a cache instance used to store active sessions. Creation is done by first
* {@link #getCacheManager() acquiring} the {@code CacheManager}. If the cache manager is not null, the
* cache returned is that resulting from the following call:
* <pre> String name = {@link #getActiveSessionsCacheName() getActiveSessionsCacheName()};
* cacheManager.getCache(name);</pre>
*
* @return a cache instance used to store active sessions, or {@code null} if the {@code CacheManager} has
* not been set.
*/
protected Cache<Serializable, Session> createActiveSessionsCache() {
Cache<Serializable, Session> cache = null;
CacheManager mgr = getCacheManager();
if (mgr != null) {
String name = getActiveSessionsCacheName();
cache = mgr.getCache(name);
}
return cache;
}