當前位置: 首頁>>代碼示例>>Java>>正文


Java Cache.remove方法代碼示例

本文整理匯總了Java中org.apache.shiro.cache.Cache.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java Cache.remove方法的具體用法?Java Cache.remove怎麽用?Java Cache.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.shiro.cache.Cache的用法示例。


在下文中一共展示了Cache.remove方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: crearCachedSessionInfo

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
public void crearCachedSessionInfo(String principal) {
	try {
		logger.warn(">>> 清除用戶[{}]的會話緩存", principal);
		String cacheName = sessionDAO.getActiveSessionsCacheName();
		Cache<String,Object> cache = sessionDAO.getCacheManager().getCache(cacheName);
		/**
		 * @see #SimpleSessionDAO
		 */
		String sessionId = (String) cache.get(principal);
		if(!StringUtils.isEmpty(sessionId)){
			cache.remove(sessionId);
			cache.remove(principal);
		}
	} catch (Exception e) {
		logger.error(String.format(">>> 清除用戶[%s]的會話緩存發生異常: %s", principal, e.getMessage()), e);
	}
}
 
開發者ID:penggle,項目名稱:xproject,代碼行數:18,代碼來源:ShiroCacheServiceImpl.java

示例2: clearAllCachedAuthorizationInfo

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * 清除所有用戶授權信息緩存.
 */
public void clearAllCachedAuthorizationInfo() {
	if (logger.isDebugEnabled()) {
		logger.debug("clearAllCachedAuthorizationInfo() - start"); //$NON-NLS-1$
	}

	Cache<Object, AuthorizationInfo> cache = getAuthorizationCache();
	if (cache != null) {
		for (Object key : cache.keys()) {
			cache.remove(key);
		}
	}

	if (logger.isDebugEnabled()) {
		logger.debug("clearAllCachedAuthorizationInfo() - end"); //$NON-NLS-1$
	}
}
 
開發者ID:leiyong0326,項目名稱:phone,代碼行數:20,代碼來源:ShiroCustomRealm.java

示例3: clearAllCachedAuthorizationInfo

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * 清除所有用戶授權信息緩存.
 */
public void clearAllCachedAuthorizationInfo() {
	Cache<Object, AuthorizationInfo> cache = getAuthorizationCache();
	if (cache != null) {
		for (Object key : cache.keys()) {
			cache.remove(key);
		}
	}
}
 
開發者ID:jiangzongyao,項目名稱:kettle_support_kettle8.0,代碼行數:12,代碼來源:Authorizing2Realm.java

示例4: removeAll

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * 從緩存中移除所有
 *
 * @param cacheName
 */
public static void removeAll(String cacheName) {
	Cache<String, Object> cache = getCache(cacheName);
	Set<String> keys = cache.keys();
	for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
		cache.remove(it.next());
	}
	logger.info("清理緩存: {} => {}", cacheName, keys);
}
 
開發者ID:funtl,項目名稱:framework,代碼行數:14,代碼來源:CacheUtils.java

示例5: remove

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * 刪除緩存數據 緩存名稱
 * @param cacheName 緩存key
 * @param key
 * @return
 */
@Override
public Object remove(String cacheName,String key){
	Cache<Object, Object> cache = cacheManager.getCache(cacheName);
	cacheManager.getCacheManager().removeCache(cacheName);
	return cache.remove(key);
}
 
開發者ID:babymm,項目名稱:mumu,代碼行數:13,代碼來源:EHCacheManager.java

示例6: removeAll

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * 從緩存中移除所有
 * @param cacheName
 */
public static void removeAll(String cacheName) {
	Cache<String, Object> cache = getCache(cacheName);
	Set<String> keys = cache.keys();
	for (Iterator<String> it = keys.iterator(); it.hasNext();){
		cache.remove(it.next());
	}
	logger.info("清理緩存: {} => {}", cacheName, keys);
}
 
開發者ID:egojit8,項目名稱:easyweb,代碼行數:13,代碼來源:CacheUtils.java

示例7: removeAll

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * 從緩存中移除所有
 *
 * @param cacheName
 */
public static void removeAll(String cacheName) {
    Cache<String, Object> cache = getCache(cacheName);
    Set<String> keys = cache.keys();
    for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
        cache.remove(it.next());
    }
    logger.info("清理緩存: {} => {}", cacheName, keys);
}
 
開發者ID:ansafari,項目名稱:melon,代碼行數:14,代碼來源:CacheUtils.java

示例8: uncache

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * Removes the specified Session from the cache.
 *
 * @param session the session to remove from the cache.
 */
protected void uncache(Session session) {
    if (session == null) {
        return;
    }
    Serializable id = session.getId();
    if (id == null) {
        return;
    }
    Cache<Serializable, Session> cache = getActiveSessionsCacheLazy();
    if (cache != null) {
        cache.remove(id);
    }
}
 
開發者ID:xuegongzi,項目名稱:rabbitframework,代碼行數:19,代碼來源:CachingSessionDAO.java

示例9: cleanAuthorizationCache

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
public void cleanAuthorizationCache(String userId) {
	String prefix = cacheKeyPrefix + authz_key + userId;
	Cache<Object, AuthorizationInfo> cache = getAuthorizationCache();
	if (cache != null) {
		cache.remove(prefix);
	}
}
 
開發者ID:xuegongzi,項目名稱:rabbitframework,代碼行數:8,代碼來源:SecurityAuthorizingRealm.java

示例10: clearAllCachedAuthorizationInfo

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
public void clearAllCachedAuthorizationInfo() {
  Cache<Object, AuthorizationInfo> cache = getAuthorizationCache();
  if (cache != null) {
    LOG.info("cache: {}", cache);
    for (Object key : cache.keys()) {
      LOG.info("remove {}", key);
      cache.remove(key);
    }
  }
}
 
開發者ID:colin-lee,項目名稱:shiro-spring-support,代碼行數:11,代碼來源:ShiroCasRealm.java

示例11: clearAllCachedAuthorizationInfo

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * 清除所有用戶授權信息緩存.
 */
public void clearAllCachedAuthorizationInfo() {
    Cache<Object, AuthorizationInfo> cache = getAuthorizationCache();
    if (cache != null) {
        for (Object key : cache.keys()) {
            cache.remove(key);
        }
    }
}
 
開發者ID:GlacierSoft,項目名稱:netloan-project,代碼行數:12,代碼來源:CustomPermissionsRealm.java

示例12: deleteFromCache

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
private void deleteFromCache(String sessionId) {
    final Cache<String, SimpleSession> cache = this.cache;
    if (cache != null) {
        cache.remove(sessionId);
    }
}
 
開發者ID:line,項目名稱:centraldogma,代碼行數:7,代碼來源:FileBasedSessionDAO.java

示例13: clearCachedAuthorizationInfo

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * Clears out the AuthorizationInfo cache entry for the specified account.
 * <p/>
 * This method is provided as a convenience to subclasses so they can invalidate a cache entry when they
 * change an account's authorization data (add/remove roles or permissions) during runtime.  Because an account's
 * AuthorizationInfo can be cached, there needs to be a way to invalidate the cache for only that account so that
 * subsequent authorization operations don't used the (old) cached value if account data changes.
 * <p/>
 * After this method is called, the next authorization check for that same account will result in a call to
 * {@link #getAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection) getAuthorizationInfo}, and the
 * resulting return value will be cached before being returned so it can be reused for later authorization checks.
 * <p/>
 * If you wish to clear out all associated cached data (and not just authorization data), use the
 * {@link #clearCache(org.apache.shiro.subject.PrincipalCollection)} method instead (which will in turn call this
 * method by default).
 *
 * @param principals the principals of the account for which to clear the cached AuthorizationInfo.
 */
protected void clearCachedAuthorizationInfo(PrincipalCollection principals) {
    if (principals == null) {
        return;
    }

    Cache<Object, AuthorizationInfo> cache = getAvailableAuthorizationCache();
    //cache instance will be non-null if caching is enabled:
    if (cache != null) {
        Object key = getAuthorizationCacheKey(principals);
        cache.remove(key);
    }
}
 
開發者ID:xuegongzi,項目名稱:rabbitframework,代碼行數:31,代碼來源:AuthorizingRealm.java

示例14: clearCachedAuthenticationInfo

import org.apache.shiro.cache.Cache; //導入方法依賴的package包/類
/**
 * Clears out the AuthenticationInfo cache entry for the specified account.
 * <p/>
 * This method is provided as a convenience to subclasses so they can invalidate a cache entry when they
 * change an account's authentication data (e.g. reset password) during runtime.  Because an account's
 * AuthenticationInfo can be cached, there needs to be a way to invalidate the cache for only that account so that
 * subsequent authentication operations don't used the (old) cached value if account data changes.
 * <p/>
 * After this method is called, the next authentication for that same account will result in a call to
 * {@link #doGetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken) doGetAuthenticationInfo}, and the
 * resulting return value will be cached before being returned so it can be reused for later authentications.
 * <p/>
 * If you wish to clear out all associated cached data (and not just authentication data), use the
 * {@link #clearCache(org.apache.shiro.subject.PrincipalCollection)} method instead (which will in turn call this
 * method by default).
 *
 * @param principals the principals of the account for which to clear the cached AuthorizationInfo.
 * @see #clearCache(org.apache.shiro.subject.PrincipalCollection)
 * @since 1.2
 */
protected void clearCachedAuthenticationInfo(PrincipalCollection principals) {
    if (!CollectionUtils.isEmpty(principals)) {
        Cache<Object, AuthenticationInfo> cache = getAvailableAuthenticationCache();
        //cache instance will be non-null if caching is enabled:
        if (cache != null) {
            Object key = getAuthenticationCacheKey(principals);
            cache.remove(key);
        }
    }
}
 
開發者ID:xuegongzi,項目名稱:rabbitframework,代碼行數:31,代碼來源:AuthenticatingRealm.java


注:本文中的org.apache.shiro.cache.Cache.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。